diff options
author | Siri Hansen <[email protected]> | 2011-06-20 11:27:05 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2011-06-20 11:27:05 +0200 |
commit | 4dbcaa8fa84d6aa0a70a5fac9465dd7cbf2b0c76 (patch) | |
tree | e9142e45f480f8d637878a9534709260f2f1976a /lib/stdlib | |
parent | bd1e97408b2b8922d96d9dcda027a1dca342366a (diff) | |
parent | d798caa64f4bb7509e89e6b8161c7eb196bc7270 (diff) | |
download | otp-4dbcaa8fa84d6aa0a70a5fac9465dd7cbf2b0c76.tar.gz otp-4dbcaa8fa84d6aa0a70a5fac9465dd7cbf2b0c76.tar.bz2 otp-4dbcaa8fa84d6aa0a70a5fac9465dd7cbf2b0c76.zip |
Merge branch 'dev' into major
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/src/erl_tar.erl | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/lib/stdlib/src/erl_tar.erl b/lib/stdlib/src/erl_tar.erl index fd85c7aef5..306834e845 100644 --- a/lib/stdlib/src/erl_tar.erl +++ b/lib/stdlib/src/erl_tar.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -798,30 +798,10 @@ set_extracted_file_info(Name, #tar_header{mode=Mode, mtime=Mtime}) -> %% Makes all directories leading up to the file. -make_dirs(Name, Type) -> - make_dirs1(filename:split(Name), Type). - -make_dirs1([Dir, Next|Rest], Type) -> - case file:read_file_info(Dir) of - {ok, #file_info{type=directory}} -> - make_dirs1([filename:join(Dir, Next)|Rest], Type); - {ok, #file_info{}} -> - throw({error, enotdir}); - {error, _} -> - case file:make_dir(Dir) of - ok -> - make_dirs1([filename:join(Dir, Next)|Rest], Type); - {error, Reason} -> - throw({error, Reason}) - end - end; -make_dirs1([_], file) -> ok; -make_dirs1([Dir], dir) -> - file:make_dir(Dir); -make_dirs1([], _) -> - %% There must be something wrong here. The list was not supposed - %% to be empty. - throw({error, enoent}). +make_dirs(Name, file) -> + filelib:ensure_dir(Name); +make_dirs(Name, dir) -> + filelib:ensure_dir(filename:join(Name,"*")). %% Prints the message on if the verbose option is given (for reading). |