+ # full path to the pidict file is requested
+ if hidden:
+ # new-style dot-prefixed pidict files
+ # are in the system-dependant temporary diretory
+ dir = getTmpDir()
+ else:
+ # old-style non-dot-prefixed pidict files
+ # are in the user's home directory
+ dir = os.getenv("HOME")
+ pass
+ pass
+ return generateFileName(dir,
+ suffix="pidict",
+ hidden=hidden,
+ with_username=True,
+ with_hostname=True,
+ with_port=port,
+ with_app=appname.upper())
+
+def appliCleanOmniOrbConfig(port):
+ """
+ Remove omniorb config files related to the port in SALOME application:
+ - ${HOME}/${APPLI}/USERS/.omniORB_${USER}_${HOSTNAME}_${NSPORT}.cfg
+ - ${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg
+ the last is removed only if the link points to the first file.
+ """
+ from salome_utils import generateFileName
+ home = os.getenv("HOME")
+ appli = os.getenv("APPLI")
+ if appli is None:
+ #Run outside application context
+ pass
+ else:
+ dir = os.path.join(home, appli,"USERS")
+ omniorb_config = generateFileName(dir, prefix="omniORB",
+ extension="cfg",
+ hidden=True,
+ with_username=True,
+ with_hostname=True,
+ with_port=port)
+ last_running_config = generateFileName(dir, prefix="omniORB",
+ with_username=True,
+ suffix="last",
+ extension="cfg",
+ hidden=True)
+ if os.access(last_running_config,os.F_OK):
+ pointedPath = os.readlink(last_running_config)
+ if pointedPath[0] != '/':
+ pointedPath=os.path.join(os.path.dirname(last_running_config), pointedPath)
+ if pointedPath == omniorb_config:
+ os.unlink(last_running_config)
+ pass
+ pass
+ if os.access(omniorb_config,os.F_OK):
+ os.remove(omniorb_config)
+ pass
+
+ #try to relink last.cfg to an existing config file if any
+ files = glob.glob(os.path.join(os.environ["HOME"],Utils_Identity.getapplipath(),
+ "USERS",".omniORB_"+salome_utils.getUserName()+"_*.cfg"))
+ current_config=None
+ current=0
+ for f in files:
+ stat=os.stat(f)
+ if stat.st_atime > current:
+ current=stat.st_atime
+ current_config=f
+ if current_config:
+ os.symlink(os.path.normpath(current_config), last_running_config)
+
+ pass
+ pass