From: jfa Date: Wed, 15 Apr 2020 13:21:01 +0000 (+0300) Subject: bos #18341: HOME environment variable X-Git-Tag: V9_5_0b1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6d20c6023e9696f892ce0cb01b2ace17bd72e325;p=modules%2Fhomard.git bos #18341: HOME environment variable --- diff --git a/bin/runHOMARD.py b/bin/runHOMARD.py index d78edfe2..d2109611 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 81d752e6..b6bdd2c9 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 0e06a645..f4cd0cc1 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 51202e18..dde42a69 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 = "<