--- nfo/projects/netfraggle/bin/fraggleCtlPreferences.py 2004/08/30 12:50:47 1.6 +++ nfo/projects/netfraggle/bin/fraggleCtlPreferences.py 2004/09/01 21:43:30 1.7 @@ -12,11 +12,12 @@ self.fraggleXML = fraggleParserXML.create(self) def __init__(self,parent): + self.engine = parent self.configList = {} - self.prefsfile = os.path.join(self.getDefaultDir(), 'prefs.xml') self.__init_fraggle_xml__() self.restoreProfiles() - + self.prefsfile = os.path.join(self.engine.getDefaultDir(), 'prefs.xml') + #def savePrefs(): @@ -36,12 +37,12 @@ self.fraggleXML.marshalXML(self.configList, self.prefsfile) def saveProfiles(self): - profilesTemp = os.path.join(self.getDefaultDir(), 'profiles.xml') + profilesTemp = os.path.join(self.engine.getDefaultDir(), 'profiles.xml') self.fraggleXML.marshalXML(self.profileDictionary, profilesTemp) #print self.profileDictionary def restoreProfiles(self): - profiles = os.path.join(self.getDefaultDir(), 'profiles.xml') + profiles = os.path.join(self.engine.getDefaultDir(), 'profiles.xml') self.profileDictionary = self.fraggleXML.unmarshalXML(profiles) #print self.profileDictionary @@ -92,24 +93,5 @@ except IndexError: pass - # from Pears: http://project5.freezope.org/pears/ - def getDefaultDir(self): - """Gets location of default dir and creates it - if necessary. ($HOME/.pears/)""" - try: - import pearsdebug - savedir = pearsdebug.savedir - except: - dir = '.netfraggle' - savedir = os.path.expanduser(os.path.join('~', dir)) - if len(savedir)<=len("c:\\/" + dir): - # problem that might occur on Win2k (no $HOME environment variable) - temp = os.path.join(os.path.expandvars('$USERPROFILE'), dir) - if temp > len("c:\\/" + dir): - savedir = temp - # create dir if it doesn't exist - if not os.path.exists(savedir): - os.makedirs(savedir) - return savedir \ No newline at end of file