From 02b72f3257a9e754cbeca266658c4bb8855c810e Mon Sep 17 00:00:00 2001 From: Reinhard Kotucha Date: Sat, 8 Nov 2008 16:12:43 +0000 Subject: TLUtils.pm: New function touch() added. git-svn-id: svn://tug.org/texlive/trunk@11224 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLUtils.pm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'Master') diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index ecae24bfc46..0f6712e5775 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -40,6 +40,7 @@ C -- utilities used in the TeX Live infrastructure TeXLive::TLUtils::mkdirhier($path); TeXLive::TLUtils::rmtree($root, $verbose, $safe); TeXLive::TLUtils::copy($file, $target_dir); + TeXLive::TLUtils::touch(@files); TeXLive::TLUtils::download_file($path, $destination [, $progs ]); TeXLive::TLUtils::setup_programs($bindir, $platform); @@ -89,6 +90,7 @@ BEGIN { &mkdirhier &rmtree © + &touch &install_package &install_packages &make_var_skeleton @@ -748,6 +750,30 @@ sub copy { } } + +=pod + +=item C + +Update modification and access time of C<@files>. Non existent files +are created. + +=cut + +sub touch { + my @files=@_; + + foreach my $file (@_) { + if (-e $file) { + utime time, time, $file; + } else { + open TMP, ">>$file" && close TMP + or warn "Can't update timestamps of $file: $!\n"; + } + } +} + + =pod =item C -- cgit v1.2.3