aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2014-02-24 16:45:04 +0100
committerLukas Larsson <[email protected]>2014-02-24 16:45:04 +0100
commita157ffce8e25012512e0e5d88e05fb135792f161 (patch)
tree8c2bf21e8a401f696483d6e7d08ff00dd805c06c /lib/stdlib
parent4ce83eb728748787f8a2da6155112c6da42a0eba (diff)
parent81abbc48e12317a07a8d2fcc041031c1c1567c8d (diff)
downloadotp-a157ffce8e25012512e0e5d88e05fb135792f161.tar.gz
otp-a157ffce8e25012512e0e5d88e05fb135792f161.tar.bz2
otp-a157ffce8e25012512e0e5d88e05fb135792f161.zip
Merge branch 'lukas/ose/master/OTP-11334'
* lukas/ose/master/OTP-11334: (71 commits) erts: Fix unix efile assert ose: Use -O2 when building ose: Expand OSE docs ose: Add dummy ttsl driver ose: Cleanup cleanup of mutex selection defines ose: Polish mmap configure checks ose: Add ose specific x-compile flags ose: Updating fd_driver and spawn_driver for OSE ose: Updating event and signal API for OSE ose: Cleanup of mutex selection defines win32: Compile erl_log.exe ose: Remove uneccesary define ose: Fix ssl configure test for osx erts: Fix sys_msg_dispatcher assert ose: Fix broken doc links ose: Thread priorities configurable from lmconf ose: Yielding the cpu is done "the OSE" way ose: Start using ppdata for tse key ose: Do not use spinlocks on OSE ose: Fix support for crypto ... Conflicts: lib/crypto/c_src/crypto.c
Diffstat (limited to 'lib/stdlib')
-rw-r--r--lib/stdlib/src/filename.erl6
-rw-r--r--lib/stdlib/test/filename_SUITE.erl53
2 files changed, 38 insertions, 21 deletions
diff --git a/lib/stdlib/src/filename.erl b/lib/stdlib/src/filename.erl
index 66e54ef221..e6bde5673c 100644
--- a/lib/stdlib/src/filename.erl
+++ b/lib/stdlib/src/filename.erl
@@ -516,8 +516,10 @@ pathtype(Atom) when is_atom(Atom) ->
pathtype(atom_to_list(Atom));
pathtype(Name) when is_list(Name) or is_binary(Name) ->
case os:type() of
- {unix, _} -> unix_pathtype(Name);
- {win32, _} -> win32_pathtype(Name)
+ {win32, _} ->
+ win32_pathtype(Name);
+ {_, _} ->
+ unix_pathtype(Name)
end.
unix_pathtype(<<$/,_/binary>>) ->
diff --git a/lib/stdlib/test/filename_SUITE.erl b/lib/stdlib/test/filename_SUITE.erl
index 232df6a13f..ecd9cff9f9 100644
--- a/lib/stdlib/test/filename_SUITE.erl
+++ b/lib/stdlib/test/filename_SUITE.erl
@@ -96,11 +96,19 @@ absname(Config) when is_list(Config) ->
?line file:set_cwd(Cwd),
ok;
- {unix, _} ->
- ?line ok = file:set_cwd("/usr"),
- ?line "/usr/foo" = filename:absname(foo),
- ?line "/usr/foo" = filename:absname("foo"),
- ?line "/usr/../ebin" = filename:absname("../ebin"),
+ Type ->
+ case Type of
+ {unix, _} ->
+ ?line ok = file:set_cwd("/usr"),
+ ?line "/usr/foo" = filename:absname(foo),
+ ?line "/usr/foo" = filename:absname("foo"),
+ ?line "/usr/../ebin" = filename:absname("../ebin");
+ {ose, _} ->
+ ?line ok = file:set_cwd("/romfs"),
+ ?line "/romfs/foo" = filename:absname(foo),
+ ?line "/romfs/foo" = filename:absname("foo"),
+ ?line "/romfs/../ebin" = filename:absname("../ebin")
+ end,
?line file:set_cwd("/"),
?line "/foo" = filename:absname(foo),
@@ -155,7 +163,7 @@ absname_2(Config) when is_list(Config) ->
?line "a:/erlang" = filename:absname("a:erlang", [Drive|":/"]),
ok;
- {unix, _} ->
+ _ ->
?line "/usr/foo" = filename:absname(foo, "/usr"),
?line "/usr/foo" = filename:absname("foo", "/usr"),
?line "/usr/../ebin" = filename:absname("../ebin", "/usr"),
@@ -189,7 +197,7 @@ basename_1(Config) when is_list(Config) ->
?line "foo" = filename:basename(["usr\\foo\\"]),
?line "foo" = filename:basename("A:\\usr\\foo"),
?line "foo" = filename:basename("A:foo");
- {unix, _} ->
+ _ ->
?line "strange\\but\\true" =
filename:basename("strange\\but\\true")
end,
@@ -219,7 +227,7 @@ basename_2(Config) when is_list(Config) ->
?line "foo.erl" = filename:basename("c:\\usr.hrl\\foo.erl",
".hrl"),
?line "foo" = filename:basename("A:\\usr\\foo", ".hrl");
- {unix, _} ->
+ _ ->
?line "strange\\but\\true" =
filename:basename("strange\\but\\true.erl", ".erl"),
?line "strange\\but\\true" =
@@ -317,7 +325,7 @@ join(Config) when is_list(Config) ->
filename:join(["A:","C:usr","foo.erl"]),
?line "d:/foo" = filename:join([$D, $:, $/, []], "foo"),
ok;
- {unix, _} ->
+ _ ->
ok
end.
@@ -332,7 +340,7 @@ pathtype(Config) when is_list(Config) ->
?line volumerelative = filename:pathtype("/usr/local/bin"),
?line volumerelative = filename:pathtype("A:usr/local/bin"),
ok;
- {unix, _} ->
+ _ ->
?line absolute = filename:pathtype("/"),
?line absolute = filename:pathtype("/usr/local/bin"),
ok
@@ -450,10 +458,17 @@ absname_bin(Config) when is_list(Config) ->
?line file:set_cwd(Cwd),
ok;
- {unix, _} ->
- ?line ok = file:set_cwd(<<"/usr">>),
- ?line <<"/usr/foo">> = filename:absname(<<"foo">>),
- ?line <<"/usr/../ebin">> = filename:absname(<<"../ebin">>),
+ Type ->
+ case Type of
+ {unix,_} ->
+ ?line ok = file:set_cwd(<<"/usr">>),
+ ?line <<"/usr/foo">> = filename:absname(<<"foo">>),
+ ?line <<"/usr/../ebin">> = filename:absname(<<"../ebin">>);
+ {ose,_} ->
+ ?line ok = file:set_cwd(<<"/romfs">>),
+ ?line <<"/romfs/foo">> = filename:absname(<<"foo">>),
+ ?line <<"/romfs/../ebin">> = filename:absname(<<"../ebin">>)
+ end,
?line file:set_cwd(<<"/">>),
?line <<"/foo">> = filename:absname(<<"foo">>),
@@ -503,7 +518,7 @@ absname_bin_2(Config) when is_list(Config) ->
?line <<"a:/erlang">> = filename:absname(<<"a:erlang">>, <<Drive:8,":/">>),
ok;
- {unix, _} ->
+ _ ->
?line <<"/usr/foo">> = filename:absname(<<"foo">>, <<"/usr">>),
?line <<"/usr/../ebin">> = filename:absname(<<"../ebin">>, <<"/usr">>),
@@ -527,7 +542,7 @@ basename_bin_1(Config) when is_list(Config) ->
{win32, _} ->
?line <<"foo">> = filename:basename(<<"A:\\usr\\foo">>),
?line <<"foo">> = filename:basename(<<"A:foo">>);
- {unix, _} ->
+ _ ->
?line <<"strange\\but\\true">> =
filename:basename(<<"strange\\but\\true">>)
end,
@@ -551,7 +566,7 @@ basename_bin_2(Config) when is_list(Config) ->
?line <<"foo.erl">> = filename:basename(<<"c:\\usr.hrl\\foo.erl">>,
<<".hrl">>),
?line <<"foo">> = filename:basename(<<"A:\\usr\\foo">>, <<".hrl">>);
- {unix, _} ->
+ _ ->
?line <<"strange\\but\\true">> =
filename:basename(<<"strange\\but\\true.erl">>, <<".erl">>),
?line <<"strange\\but\\true">> =
@@ -639,7 +654,7 @@ join_bin(Config) when is_list(Config) ->
filename:join([<<"A:">>,<<"C:usr">>,<<"foo.erl">>]),
?line <<"d:/foo">> = filename:join([$D, $:, $/, []], <<"foo">>),
ok;
- {unix, _} ->
+ _ ->
ok
end.
@@ -653,7 +668,7 @@ pathtype_bin(Config) when is_list(Config) ->
volumerelative = filename:pathtype(<<"/usr/local/bin">>),
volumerelative = filename:pathtype(<<"A:usr/local/bin">>),
ok;
- {unix, _} ->
+ _ ->
absolute = filename:pathtype(<<"/">>),
absolute = filename:pathtype(<<"/usr/local/bin">>),
ok