From: jfa Date: Wed, 15 Apr 2020 13:21:01 +0000 (+0300) Subject: Fix for bos #18341: HOME environment variable X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fjfa%2F18341_HOME;p=modules%2Fhomard.git Fix for bos #18341: HOME environment variable --- diff --git a/bin/runHOMARD.py b/bin/runHOMARD.py index 9eefe9e6..e05437e4 100755 --- a/bin/runHOMARD.py +++ b/bin/runHOMARD.py @@ -180,7 +180,8 @@ class Server: class CatalogServer(Server): SCMD1=['SALOME_ModuleCatalog_Server','-common'] - SCMD2=['-personal','${HOME}/Salome/resources/CatalogModulePersonnel.xml'] + home_dir=os.path.expanduser("~") + SCMD2=['-personal',os.path.join(home_dir,'Salome', 'resources', 'CatalogModulePersonnel.xml')] def setpath(self,liste_modules): cata_path=[] diff --git a/doc/files/yacs_script.py b/doc/files/yacs_script.py index 351e80e7..bd180eda 100755 --- a/doc/files/yacs_script.py +++ b/doc/files/yacs_script.py @@ -373,13 +373,7 @@ Controle les arguments et stockage de quelques informations # # 1.2. Le repertoire de calcul # - if "HOME" in os.environ : - HOME = os.environ ["HOME"] - else : - HOME = "/local/home/salome" -# - if ( self.rep_calc[:1] == "~" ) : - self.rep_calc = os.path.join(HOME, self.rep_calc[2:]) + self.rep_calc = os.path.expanduser(self.rep_calc) if not os.path.isdir(self.rep_calc) : self.message_info += "Repertoire " + self.rep_calc erreur = -4 @@ -392,8 +386,7 @@ Controle les arguments et stockage de quelques informations # fic = self.mesh_file # - if ( fic[:1] == "~" ) : - fic = os.path.join(HOME, fic[2:]) + fic = os.path.expanduser(fic) if not os.path.isfile(fic) : aux = os.path.join(self.rep_calc, fic) if not os.path.isfile(aux) : diff --git a/doc/files/yacs_script_test.py b/doc/files/yacs_script_test.py index 9a4a1252..a8766e31 100755 --- a/doc/files/yacs_script_test.py +++ b/doc/files/yacs_script_test.py @@ -190,13 +190,7 @@ Controle les arguments et stockage de quelques informations # # 1.2. Le repertoire de calcul # - if "HOME" in os.environ : - HOME = os.environ ["HOME"] - else : - HOME = "/local/home/salome" -# - if ( self.rep_calc[:1] == "~" ) : - self.rep_calc = os.path.join(HOME, self.rep_calc[2:]) + self.rep_calc = os.path.expanduser(self.rep_calc) if not os.path.isdir(self.rep_calc) : self.message_info += "Repertoire " + self.rep_calc erreur = -4 @@ -209,8 +203,7 @@ Controle les arguments et stockage de quelques informations # fic = self.mesh_file # - if ( fic[:1] == "~" ) : - fic = os.path.join(HOME, fic[2:]) + fic = os.path.expanduser(fic) if not os.path.isfile(fic) : aux = os.path.join(self.rep_calc, fic) if not os.path.isfile(aux) : diff --git a/src/HOMARD_I/HOMARD_Gen_i.cxx b/src/HOMARD_I/HOMARD_Gen_i.cxx index b1cbfbea..362a41fc 100644 --- a/src/HOMARD_I/HOMARD_Gen_i.cxx +++ b/src/HOMARD_I/HOMARD_Gen_i.cxx @@ -36,6 +36,7 @@ #include "utilities.h" #include "Basics_Utils.hxx" +#include "Basics_DirUtils.hxx" #include "Utils_SINGLETON.hxx" #include "Utils_CorbaException.hxx" #include "SALOMEDS_Tool.hxx" @@ -5260,7 +5261,7 @@ void HOMARD_Gen_i::SetPreferences( ) if ( ok ) { std::string PrefFile ; - PrefFile = getenv("HOME") ; + PrefFile = Kernel_Utils::HomePath() ; PrefFile += "/.config/salome/SalomeApprc." + salome_version ; MESSAGE ( "PrefFile = "<