Added support for relative/absolute path mgmt for stored files.

This commit is contained in:
Markus Lampert
2019-11-09 19:57:58 -08:00
parent a2935d5ff0
commit c6f14b9836
16 changed files with 94 additions and 45 deletions

View File

@@ -263,7 +263,10 @@ class ToolBitLibrary(object):
for row in range(self.model.rowCount()):
toolNr = self.model.data(self.model.index(row, 0), PySide.QtCore.Qt.EditRole)
toolPath = self.model.data(self.model.index(row, 0), _PathRole)
tools.append({'nr': toolNr, 'path': toolPath})
if PathPreferences.toolsStoreAbsolutePaths():
tools.append({'nr': toolNr, 'path': toolPath})
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)