Salome HOME
Bug SWP13450 : Using of 'cp' command is incorrect
[modules/kernel.git] / src / KERNEL_PY / salome_test.py
index 9fb6b3489ab9657ab717306d8aff7a5534c44e3c..d18c706e2d0411fb74b701af2797095f144cbb43 100755 (executable)
@@ -466,9 +466,19 @@ try:
     if os.access(medFile, os.R_OK) :
        if not os.access(medFile, os.W_OK) :
               import random
-              medFileNew = "/tmp/" + str(random.randint(0,1000000)) + "_" + medFileName
+               if sys.platform != "win32":
+                 tmpDir = "/tmp/"
+               else:
+                 tmpDir = os.getenv('TEMP') + '/'
+              medFileNew = tmpDir + str(random.randint(0,1000000)) + "_" + medFileName
               print " -- Copy " + medFile + " to " + medFileNew
-              os.system("cp "+ medFile + " " + medFileNew)
+
+               if sys.platform != "win32":
+                 copyCommand = "cp"
+               else:
+                 copyCommand = "copy /Y"
+              os.system(copyCommand + " " + medFile + " " + medFileNew)
+
               medFile = medFileNew
               os.system("chmod 755 " + medFile)