Skip to content

Commit

Permalink
stable against ilidata: entry as path
Browse files Browse the repository at this point in the history
  • Loading branch information
signedav committed Sep 25, 2023
1 parent ec25d23 commit 83038c7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions QgisModelBaker/gui/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,14 +674,22 @@ def _load_config_file(self):
self.config_file_line_edit.setText(self._relative_path(filename))

def _relative_path(self, path):
if QgsProject.instance().homePath() and os.path.isabs(path):
if (
os.path.isfile(path)
and QgsProject.instance().homePath()
and os.path.isabs(path)
):
# if it's a saved project and the path is not (yet) relative
return os.path.relpath(path, QgsProject.instance().homePath())
else:
return path

def _absolute_path(self, path):
if path and QgsProject.instance().homePath() and not os.path.isabs(path):
if (
os.path.isfile(path)
and QgsProject.instance().homePath()
and not os.path.isabs(path)
):
# if it's a saved project and the path is not not absolute
return os.path.join(path, QgsProject.instance().homePath(), path)
else:
Expand Down

0 comments on commit 83038c7

Please sign in to comment.