diff options
-rw-r--r-- | mageiaSync/mageiasync.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mageiaSync/mageiasync.py b/mageiaSync/mageiasync.py index c5dbb57..e634e4c 100644 --- a/mageiaSync/mageiasync.py +++ b/mageiaSync/mageiasync.py @@ -17,6 +17,8 @@ from PyQt6.QtGui import ( from PyQt6.QtCore import QLibraryInfo, QUrl, QItemSelectionModel, QFileInfo from PyQt6 import QtCore, uic # , Qt, QThread, QObject, pyqtSignal) import sys +import glob +import os try: from . import mageiaSyncExt @@ -470,9 +472,9 @@ class IsosViewer(QMainWindow): def rename(self): # rename old isos and directories to a new release self.rd = renameDialog() - loc = [] - loc = self.location.split("/") - self.rd.oldRelease.setText(loc[-1]) + prefix = os.path.commonprefix([x for x in glob.glob("*", root_dir=self.destination) if os.path.isdir(os.path.join(self.destination,x))]) + self.rd.oldRelease.setText(prefix) + self.rd.newRelease.setText(prefix) self.rd.chooseDir.setText(self.destination) answer = self.rd.exec() if answer: @@ -487,7 +489,7 @@ class IsosViewer(QMainWindow): nbf, nbr ) self.lvMessage(returnMsg) - self.updateList() + self.updateList() self.rd.close() def prefs(self): |