Salome HOME
0023235: [CEA 1730] Patches for SMESH on Windows
[modules/smesh.git] / src / Tools / MGCleanerPlug / MGCleanerMonViewText.py
index aa8170a976161a3f907f1070cfd98342c8a04734..e4030cc4443127f611517c2ca610582eb373e8f6 100644 (file)
@@ -1,10 +1,10 @@
 # -*- coding: utf-8 -*-
-# Copyright (C) 2007-2013  EDF R&D
+# Copyright (C) 2013-2016  EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,7 +19,8 @@
 #
 
 # Modules Python
-import string,types,os
+import string,types,os,sys
+import tempfile
 import traceback
 
 from PyQt4 import *
@@ -51,6 +52,7 @@ class MGCleanerMonViewText(Ui_ViewExe, QDialog):
         # Je n arrive pas a utiliser le setEnvironment du QProcess
         # fonctionne hors Salome mais pas dans Salome ???
         cmds=''
+        '''
         try :
           LICENCE_FILE=os.environ["DISTENE_LICENCE_FILE_FOR_MGCLEANER"]
         except:
@@ -69,15 +71,20 @@ class MGCleanerMonViewText(Ui_ViewExe, QDialog):
           cmds+="# $DISTENE_PATH_FOR_MGCLEANER NOT SET\n"
         #cmds+='env\n'
         cmds+='rm -f '+self.parent().fichierOut+'\n'
+        '''
         cmds+=txt+'\n'
         cmds+='echo END_OF_MGCleaner\n'
-        pid=self.monExe.pid()
-        nomFichier='/tmp/MGCleaner_'+str(pid)+'.sh'
+        ext=''
+        if sys.platform == "win32":
+            ext = '.bat'
+        else:
+            ext = '.sh'
+        nomFichier=tempfile.mktemp(suffix=ext,prefix="MGCleaner_")
         f=open(nomFichier,'w')
         f.write(cmds)
         f.close()
 
-        maBidouille='sh ' + nomFichier
+        maBidouille=nomFichier
         self.monExe.start(maBidouille)
         self.monExe.closeWriteChannel()
         self.enregistreResultatsDone=False