Use OS-independent path separators

This commit is contained in:
Florian Bruhin 2016-10-28 07:15:46 +02:00
parent 54a694e35e
commit b0a04bff8e

View File

@ -529,9 +529,13 @@ class FilenamePrompt(_BasePrompt):
@pyqtSlot(str) @pyqtSlot(str)
def _set_fileview_root(self, path): def _set_fileview_root(self, path):
"""Set the root path for the file display.""" """Set the root path for the file display."""
if not path.endswith('/') or path == '/': separators = os.sep
if os.altsep is not None:
separators += os.altsep
if path == '/' or (path and path[-1] not in separators):
return return
path.rstrip('/') path.rstrip(separators)
try: try:
if os.path.isdir(path): if os.path.isdir(path):