library file path bugs
This commit is contained in:
committed by
Markus Lampert
parent
8c4dfacb27
commit
c815115cae
@@ -299,7 +299,8 @@ def lastPathToolLibrary():
|
||||
def setLastPathToolLibrary(path):
|
||||
PathLog.track(path)
|
||||
curLib = lastFileToolLibrary()
|
||||
if os.path.split(curLib)[0] != path:
|
||||
PathLog.debug('curLib: {}'.format(curLib))
|
||||
if curLib and os.path.split(curLib)[0] != path:
|
||||
setLastFileToolLibrary('') # a path is known but not specific file
|
||||
return preferences().SetString(LastPathToolLibrary, path)
|
||||
|
||||
|
||||
@@ -383,6 +383,8 @@ class ToolBitLibrary(object):
|
||||
workingdir = os.path.dirname(PathPreferences.lastPathToolLibrary())
|
||||
defaultdir = os.path.dirname(PathPreferences.pathDefaultToolsPath())
|
||||
|
||||
PathLog.debug('workingdir: {} defaultdir: {}'.format(workingdir, defaultdir))
|
||||
|
||||
dirOK = lambda : workingdir != defaultdir and (os.access(workingdir, os.W_OK))
|
||||
|
||||
if dirOK():
|
||||
@@ -400,6 +402,7 @@ class ToolBitLibrary(object):
|
||||
PathPreferences.filePath())
|
||||
|
||||
PathPreferences.setLastPathToolLibrary("{}/Library".format(workingdir))
|
||||
PathLog.debug('setting workingdir to: {}'.format(workingdir))
|
||||
|
||||
subdirlist = ['Bit', 'Library', 'Shape']
|
||||
mode = 0o777
|
||||
@@ -605,8 +608,9 @@ class ToolBitLibrary(object):
|
||||
else:
|
||||
tools.append({'nr': toolNr, 'path': PathToolBit.findRelativePathTool(toolPath)})
|
||||
|
||||
with open(self.path, 'w') as fp:
|
||||
json.dump(library, fp, sort_keys=True, indent=2)
|
||||
if self.path is not None:
|
||||
with open(self.path, 'w') as fp:
|
||||
json.dump(library, fp, sort_keys=True, indent=2)
|
||||
|
||||
def libraryOk(self):
|
||||
self.librarySave()
|
||||
|
||||
Reference in New Issue
Block a user