diff options
Diffstat (limited to 'erts/preloaded/src/prim_file.erl')
-rw-r--r-- | erts/preloaded/src/prim_file.erl | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/erts/preloaded/src/prim_file.erl b/erts/preloaded/src/prim_file.erl index ec158ba970..eafab1bae4 100644 --- a/erts/preloaded/src/prim_file.erl +++ b/erts/preloaded/src/prim_file.erl @@ -147,6 +147,32 @@ -define(POSIX_FADV_NOREUSE, 5). +%%% BIFs + +-export([internal_name2native/1, + internal_native2name/1, + internal_normalize_utf8/1]). + +-type unicode_string() :: [unicode:unicode_char()]. +-type prim_file_name() :: unicode_string() | unicode:unicode_binary(). + +-spec internal_name2native(prim_file_name()) -> binary(). + +internal_name2native(_) -> + erlang:nif_error(undefined). + +-spec internal_native2name(binary()) -> prim_file_name(). + +internal_native2name(_) -> + erlang:nif_error(undefined). + +-spec internal_normalize_utf8(unicode:unicode_binary()) -> unicode_string(). + +internal_normalize_utf8(_) -> + erlang:nif_error(undefined). + +%%% End of BIFs + %%%----------------------------------------------------------------- %%% Functions operating on a file through a handle. ?FD_DRV. %%% @@ -648,25 +674,7 @@ set_cwd(Dir) -> set_cwd(Port, Dir) when is_port(Port) -> set_cwd_int(Port, Dir). -set_cwd_int(Port, Dir0) -> - Dir = - (catch - case os:type() of - vxworks -> - %% chdir on vxworks doesn't support - %% relative paths - %% must call get_cwd from here and use - %% absname/2, since - %% absname/1 uses file:get_cwd ... - case get_cwd_int(Port, 0) of - {ok, AbsPath} -> - filename:absname(Dir0, AbsPath); - _Badcwd -> - Dir0 - end; - _Else -> - Dir0 - end), +set_cwd_int(Port, Dir) -> %% Dir is now either a string or an EXIT tuple. %% An EXIT tuple will fail in the following catch. drv_command(Port, [?FILE_CHDIR, pathname(Dir)]). |