changeset 15579:c3869fe3d917

mx clean: make it more reliable on windows
author Bernhard Urban <bernhard.urban@jku.at>
date Fri, 09 May 2014 15:30:16 +0200
parents 24aa5dbcf92d
children ce201bb843b4
files mxtool/mx.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mxtool/mx.py	Fri May 09 14:24:02 2014 +0200
+++ b/mxtool/mx.py	Fri May 09 15:30:16 2014 +0200
@@ -2719,6 +2719,12 @@
 
     args = parser.parse_args(args)
 
+    def _rmtree(dirPath):
+        path = dirPath
+        if get_os() == 'windows':
+            path = unicode("\\\\?\\" + dirPath)
+        shutil.rmtree(path)
+
     for p in projects_opt_limit_to_suites():
         if p.native:
             if args.native:
@@ -2729,13 +2735,13 @@
                 if genDir != '' and exists(genDir):
                     log('Clearing {0}...'.format(genDir))
                     for f in os.listdir(genDir):
-                        shutil.rmtree(join(genDir, f))
+                        _rmtree(join(genDir, f))
 
 
                 outputDir = p.output_dir()
                 if outputDir != '' and exists(outputDir):
                     log('Removing {0}...'.format(outputDir))
-                    shutil.rmtree(outputDir)
+                    _rmtree(outputDir)
 
             for configName in ['netbeans-config.zip', 'eclipse-config.zip']:
                 config = TimeStampFile(join(p.suite.mxDir, configName))