diff --git a/picard/ui/filebrowser.py b/picard/ui/filebrowser.py index 5ba0d06f4..28b6085e4 100644 --- a/picard/ui/filebrowser.py +++ b/picard/ui/filebrowser.py @@ -129,15 +129,21 @@ class FileBrowser(QtGui.QTreeView): self.expand(index) self.scrollTo(index, scrolltype) + def _get_destination_from_path(self, path): + destination = os.path.normpath(unicode(path)) + if not os.path.isdir(destination): + destination = os.path.dirname(destination) + return destination + def move_files_here(self): indexes = self.selectedIndexes() if not indexes: return path = self.model.filePath(indexes[0]) - config.setting["move_files_to"] = os.path.normpath(unicode(path)) + config.setting["move_files_to"] = self._get_destination_from_path(path) def set_as_starting_directory(self): indexes = self.selectedIndexes() if indexes: path = self.model.filePath(indexes[0]) - config.setting["starting_directory_path"] = os.path.normpath(unicode(path)) + config.setting["starting_directory_path"] = self._get_destination_from_path(path)