if sys.platform == 'win32' and path.startswith('\\') and not path.startswith('\\\\') :
path = '\\' + path
return path
-
+
class PathOut :
def __init__(self, filename = None, analyse_type = '', dirout = None) :
if filename is not None :
self.filename, self.fileext = os.path.splitext(self.filebasename)
self.analyse = analyse_type
#self.dirout = self.mkdirout(dirout)
- if dirout is not None:
+ if dirout is not None:
self.dirout = os.path.abspath(dirout)
elif filename is not None and dirout is None:
self.dirout = os.path.abspath(self.directory)
- self.d = {}
+ self.d = {}
def mkdirout(self) :
dirout = os.path.join(self.dirout, self.filename + '_' + self.analyse + '_')
self.name = os.path.splitext(tdirout)[1]
return tdirout
+ def makenew(self, filename, ext):
+ nb = 1
+ newfile = '_'.join([os.path.join(self.dirout, filename), '%i' % nb]) + '.' + ext
+ while os.path.exists(newfile) :
+ nb += 1
+ newfile = '_'.join([os.path.join(self.dirout, filename), '%i' % nb]) + '.' + ext
+ return newfile
+
def createdir(self, tdirout) :
if not os.path.exists(tdirout) :
os.mkdir(tdirout)
ConfigPath = os.path.join(AppliPath, 'configuration')
DictConfigPath = {
'global': os.path.join(ConfigPath, 'global.cfg'),
+ 'preferences': os.path.join(ConfigPath, 'iramuteq.cfg'),
}
return DictConfigPath