]> git.decadent.org.uk Git - dak.git/blobdiff - utils.py
overwriting existing files is no good, mmkay? fix chmod 664 on directories.
[dak.git] / utils.py
index 40e36cd9c6a1c79111550a616a72ccb095e6320c..ef86b5adc736f80ed8afd30814236e9f5a144f1a 100644 (file)
--- a/utils.py
+++ b/utils.py
@@ -1,6 +1,6 @@
 # Utility functions
 # Copyright (C) 2000  James Troup <james@nocrew.org>
-# $Id: utils.py,v 1.4 2000-11-27 03:15:26 troup Exp $
+# $Id: utils.py,v 1.5 2000-11-30 04:19:30 troup Exp $
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -206,6 +206,8 @@ def move (src, dest):
        os.umask(umask);
     #print "Moving %s to %s..." % (src, dest);
     shutil.copy2(src, dest);
+    if os.path.exists(dest) and stat.S_ISDIR(os.stat(dest)[stat.ST_MODE]):
+       dest = dest + '/' + os.path.basename(src);
     os.chmod(dest, 0664);
     os.unlink(src);
 
@@ -220,6 +222,8 @@ def copy (src, dest):
        os.umask(umask);
     #print "Copying %s to %s..." % (src, dest);
     shutil.copy2(src, dest);
+    if os.path.exists(dest) and stat.S_ISDIR(os.stat(dest)[stat.ST_MODE]):
+       dest = dest + '/' + os.path.basename(src);
     os.chmod(dest, 0664);
 
 ######################################################################################