cleanup for using the config dir properly, and not an hard-wired ~/.sfi/
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 8 Sep 2011 12:24:13 +0000 (14:24 +0200)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 8 Sep 2011 12:24:13 +0000 (14:24 +0200)
sface/config.py
sface/sfiprocess.py
sface/sfirenew.py

index bf94cbc..edb2924 100644 (file)
@@ -1,7 +1,7 @@
 # config for sface 
 # uses in this order
 # command-line args
-# ~/.sfi/sfi_config
+# <configdir>/sfi_config
 ###
 
 import os
@@ -28,9 +28,8 @@ class Config:
         ]
 
     def __init__ (self):
-        print 'WARNING - should pass config dir'
-        self.dirname=os.path.expanduser("~/.sfi/")
-        self.read_config()
+        # no need to do anything here, we need set_dirname later on
+        pass
 
     def get_dirname (self):
         return self.dirname
index f794c63..e06bf9a 100644 (file)
@@ -89,7 +89,7 @@ class SfiProcess(QObject):
     def __getRSpec(self, mgr):
         slice = config.getSlice()
         # Write RSpec to file for testing.
-        filename = os.path.expanduser("~/.sfi/" + slice + ".rspec")
+        filename = config.fullpath ("%s.rspec"%slice)
         try:
             os.remove(filename)
         except:
index 863b253..17cd8d6 100644 (file)
@@ -44,7 +44,7 @@ class SfiRenewer(QObject):
 
     def finishedUpdateRecord(self):
         # we have to force sfi.py to download an updated slice credential
-        sliceCredName = os.path.expanduser("~/.sfi/slice_" + self.hrn.split(".")[-1] + ".cred")
+        sliceCredName = config.fullpath("slice_" + self.hrn.split(".")[-1] + ".cred")
         if os.path.exists(sliceCredName):
             os.remove(sliceCredName)