Fix attempts to unlink directories when unzipping an archive.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 23 Apr 2002 03:05:50 +0000 (03:05 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 23 Apr 2002 03:05:50 +0000 (03:05 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@343 fdb21ef1-2011-0410-befe-b5e4ea1792b1

SConstruct

index e41bf1e0642f5792da58dbe066bdbce55460cc55..4d91bb3d528c5cee340a22b9cfcff246f68bf242 100644 (file)
@@ -204,9 +204,10 @@ try:
             print dest,name
             # if the file exists, then delete it before writing
             # to it so that we don't end up trying to write to a symlink:
-            if os.path.exists(dest):
+            if os.path.isfile(dest) or os.path.islink(dest):
                 os.unlink(dest)
-            open(dest, 'w').write(zf.read(name))
+            if not os.path.isdir(dest):
+                open(dest, 'w').write(zf.read(name))
 
 except:
     if unzip and zip: