fixed the function for different kinds of paths
parent
a40fd85822
commit
cc94838ad3
|
@ -169,8 +169,15 @@ class DirWidget(QWidget):
|
|||
def set_dir(self):
|
||||
directory = QFileDialog.getExistingDirectory(self, "Select a directory.", dir=self.directory)
|
||||
if directory:
|
||||
directory = Path(directory).relative_to(Path.cwd()).as_posix()
|
||||
self.directory = "./" + directory
|
||||
directory = Path(directory)
|
||||
|
||||
if Path.cwd() in directory.parents:
|
||||
self.directory = "./" + directory.relative_to(Path.cwd()).as_posix()
|
||||
elif Path.cwd() == directory:
|
||||
self.directory = "."
|
||||
else:
|
||||
self.directory = directory.as_posix()
|
||||
|
||||
self.dir_lineedit.setText(self.directory)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue