[interchange] Add preserve_times attribute to [cp] tag.
Stefan Hornburg
interchange-cvs at icdevgroup.org
Sun Nov 14 11:57:05 UTC 2010
commit 3660fed8e00bc3fd4467d325ce9c9cc617f38ed9
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date: Sun Nov 14 12:54:04 2010 +0100
Add preserve_times attribute to [cp] tag.
code/UI_Tag/cp.coretag | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/code/UI_Tag/cp.coretag b/code/UI_Tag/cp.coretag
index 574e0ef..2cf46b7 100644
--- a/code/UI_Tag/cp.coretag
+++ b/code/UI_Tag/cp.coretag
@@ -21,6 +21,20 @@ sub {
$save_mask = umask($opt->{umask});
}
my $status = File::Copy::copy($from, $to);
+
+ if ($opt->{preserve_times}) {
+ my ($atime, $mtime);
+
+ ($atime, $mtime) = (stat $from)[8,9];
+
+ if ($atime) {
+ $status = utime($atime, $mtime, $from);
+ }
+ else {
+ $status = 0;
+ }
+ }
+
umask($save_mask) if defined $save_mask;
return '' if $opt->{hide};
return $status;
More information about the interchange-cvs
mailing list