From: Mikael Magnusson <[EMAIL PROTECTED]>

Signed-off-by: Mikael Magnusson <[EMAIL PROTECTED]>
---
 lib/ewlib/src/ewl_file.erl |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/ewlib/src/ewl_file.erl b/lib/ewlib/src/ewl_file.erl
index 503cc56..b328281 100644
--- a/lib/ewlib/src/ewl_file.erl
+++ b/lib/ewlib/src/ewl_file.erl
@@ -50,6 +50,7 @@
 %% Include Files
 %%--------------------------------------------------------------------
 -include("eunit.hrl").
+-include_lib("kernel/include/file.hrl").
 
 %%====================================================================
 %% External functions
@@ -88,8 +89,7 @@ delete_dir(Path) ->
 copy_dir(From, To) ->
     case filelib:is_dir(From) of
        false ->
-           {ok, _} = file:copy(From, To),
-           ok;
+           ok = copy_file(From, To);
        true ->
            case filelib:is_dir(To) of
                true  -> ok;
@@ -101,6 +101,16 @@ copy_dir(From, To) ->
     end.
 
 %%--------------------------------------------------------------------
+%% @doc copy a file including timestamps,ownership and mode etc.
+%% @spec copy_file(From::string(), To::string()) -> ok | {error, Reason}
+%% @end
+%%--------------------------------------------------------------------
+copy_file(From, To) ->
+    {ok, _} = file:copy(From, To),
+    {ok, FileInfo} = file:read_file_info(From),
+    file:write_file_info(To, FileInfo).
+
+%%--------------------------------------------------------------------
 %% @doc create a unique temorory directory.
 %% @spec create_tmp_dir(Prefix::string()) -> {ok, TmpDirPath} | {error, Reason}
 %% @end
-- 
1.5.6.3


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"erlware-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/erlware-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to