X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=plugins%2Fread_copyonly.py;fp=plugins%2Fread_copyonly.py;h=8096de4267d8d73bd49dc439195fdcdae995950d;hb=b5bc4ffdfbaa76db7cd4cdeb078097ec17024f6b;hp=3e6b1f2a650f401c37c4bfe189f6e0ac1c1517ac;hpb=c6d30c7f18e835e0b99032d01b1f8acd7f077ec6;p=webber.git diff --git a/plugins/read_copyonly.py b/plugins/read_copyonly.py index 3e6b1f2..8096de4 100644 --- a/plugins/read_copyonly.py +++ b/plugins/read_copyonly.py @@ -1,6 +1,6 @@ # -*- coding: iso-8859-1 -*- from webber import * -import os, fnmatch +import os, shutil, fnmatch @set_hook("read") @@ -23,9 +23,9 @@ def copyfile(params): os.makedirs(out_dir) except OSError: pass - cmd = "cp -l %s %s" % ( - os.path.join(cfg.in_dir, file.rel_path), - out_path - ) - #print cmd - os.system(cmd) + try: + shutil.copy(os.path.join(cfg.in_dir, file.rel_path), out_path) + except: + os.remove(out_path) + shutil.copy(os.path.join(cfg.in_dir, file.rel_path), out_path) + shutil.copystat(os.path.join(cfg.in_dir, file.rel_path), out_path)