aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2014-03-19 10:11:31 +0100
committerHenrik Nord <[email protected]>2014-03-19 10:11:34 +0100
commitd9323a2131ae1a61faa02070390dde8de5623eaf (patch)
tree2edd7a536c335e49fbf0e9262908fa5eee5b8130 /lib/kernel
parent14d1232bf4fba473772764fa7be0c385af642993 (diff)
parentb45af5f9608d5dc79a5f201afdcc9a7e28e7ba83 (diff)
downloadotp-d9323a2131ae1a61faa02070390dde8de5623eaf.tar.gz
otp-d9323a2131ae1a61faa02070390dde8de5623eaf.tar.bz2
otp-d9323a2131ae1a61faa02070390dde8de5623eaf.zip
Merge branch 'josevalim/set_cwd-typespec'
* josevalim/set_cwd-typespec: Correct file:set_cwd/1 typespec OTP-11787
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/doc/src/file.xml9
-rw-r--r--lib/kernel/src/file.erl3
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/kernel/doc/src/file.xml b/lib/kernel/doc/src/file.xml
index b3ec9fd33d..6d4b1cb2db 100644
--- a/lib/kernel/doc/src/file.xml
+++ b/lib/kernel/doc/src/file.xml
@@ -1630,6 +1630,11 @@
<desc>
<p>Sets the current working directory of the file server to
<c><anno>Dir</anno></c>. Returns <c>ok</c> if successful.</p>
+ <p>The functions in the <c>file</c> module usually treat binaries
+ as raw filenames, i.e. they are passed as is even when the encoding
+ of the binary does not agree with <c>file:native_name_encoding()</c>.
+ This function however expects binaries to be encoded according to the
+ value returned by <c>file:native_name_encoding()</c>.</p>
<p>Typical error reasons are:</p>
<taglist>
<tag><c>enoent</c></tag>
@@ -1654,8 +1659,8 @@
<tag><c>no_translation</c></tag>
<item>
<p><c><anno>Dir</anno></c> is a <c>binary()</c> with
- characters coded in ISO-latin-1 and the VM was started
- with the parameter <c>+fnue</c>.</p>
+ characters coded in ISO-latin-1 and the VM is operating
+ with unicode file name encoding.</p>
</item>
</taglist>
<warning>
diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl
index 23cf74f80f..20b703e084 100644
--- a/lib/kernel/src/file.erl
+++ b/lib/kernel/src/file.erl
@@ -199,7 +199,8 @@ get_cwd(Drive) ->
check_and_call(get_cwd, [file_name(Drive)]).
-spec set_cwd(Dir) -> ok | {error, Reason} when
- Dir :: name(),
+ Dir :: name() | EncodedBinary,
+ EncodedBinary :: binary(),
Reason :: posix() | badarg | no_translation.
set_cwd(Dirname) ->