diff options
author | Björn Gustavsson <[email protected]> | 2013-02-12 17:38:22 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2013-02-13 11:25:54 +0100 |
commit | 1d6ac47dc148bcfdb61c205b709b61172374eb30 (patch) | |
tree | b9ea8e5e302c7f12f3e9aee3c4ce4ff63c2d2b4b /lib/kernel/src | |
parent | 87fe90a69421b9fc462f94a6bf4b760f92fd49e0 (diff) | |
download | otp-1d6ac47dc148bcfdb61c205b709b61172374eb30.tar.gz otp-1d6ac47dc148bcfdb61c205b709b61172374eb30.tar.bz2 otp-1d6ac47dc148bcfdb61c205b709b61172374eb30.zip |
Make the file:filename() type more restrictive
The recommended type for filenames is a list of characters (which
may be Unicode characters greater than 255). Change the
file:filename() to reflect that.
For the filename module we still need a type that can be either
a string or a binary, so we need to introduce the type
file:filename_all().
Diffstat (limited to 'lib/kernel/src')
-rw-r--r-- | lib/kernel/src/file.erl | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl index 6b92d6c025..5f52f94270 100644 --- a/lib/kernel/src/file.erl +++ b/lib/kernel/src/file.erl @@ -67,8 +67,8 @@ -export([ipread_s32bu_p32bu_int/3]). %% Types that can be used from other modules -- alphabetically ordered. --export_type([date_time/0, fd/0, file_info/0, filename/0, io_device/0, - name/0, posix/0]). +-export_type([date_time/0, fd/0, file_info/0, filename/0, filename_all/0, + io_device/0, name/0, posix/0]). %%% Includes and defines -include("file.hrl"). @@ -80,7 +80,8 @@ -define(RAM_FILE, ram_file). % Module %% data types --type filename() :: string() | binary(). +-type filename() :: string(). +-type filename_all() :: string() | binary(). -type file_info() :: #file_info{}. -type fd() :: #file_descriptor{}. -type io_device() :: pid() | fd(). @@ -280,7 +281,7 @@ read_link(Name) -> -spec read_link_all(Name) -> {ok, Filename} | {error, Reason} when Name :: name(), - Filename :: filename(), + Filename :: filename_all(), Reason :: posix() | badarg. read_link_all(Name) -> @@ -313,7 +314,7 @@ list_dir(Name) -> -spec list_dir_all(Dir) -> {ok, Filenames} | {error, Reason} when Dir :: name(), - Filenames :: [filename()], + Filenames :: [filename_all()], Reason :: posix() | badarg. list_dir_all(Name) -> |