diff options
author | Papoteur <papoteur@mageia.org> | 2020-07-25 10:04:05 +0200 |
---|---|---|
committer | Papoteur <papoteur@mageia.org> | 2020-07-25 10:04:05 +0200 |
commit | beddf562449e1c896e87200ae669fdcb508e3ed1 (patch) | |
tree | ff9384a4f7dfc1b841ac93df338770c506e6483a | |
parent | 97ea13d874d84cfd600f3314e8776eb34ced90bd (diff) | |
download | MageiaSync-beddf562449e1c896e87200ae669fdcb508e3ed1.tar MageiaSync-beddf562449e1c896e87200ae669fdcb508e3ed1.tar.gz MageiaSync-beddf562449e1c896e87200ae669fdcb508e3ed1.tar.bz2 MageiaSync-beddf562449e1c896e87200ae669fdcb508e3ed1.tar.xz MageiaSync-beddf562449e1c896e87200ae669fdcb508e3ed1.zip |
Add checking for existence of local destination directory (mga#26975)
-rw-r--r-- | mageiaSync/mageiasync.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/mageiaSync/mageiasync.py b/mageiaSync/mageiasync.py index 743cac8..1110607 100644 --- a/mageiaSync/mageiasync.py +++ b/mageiaSync/mageiasync.py @@ -3,7 +3,7 @@ from PyQt5.QtWidgets import ( QProgressDialog, QMainWindow, QDialog, QFileDialog, QApplication) from PyQt5.QtGui import ( QStandardItemModel,QStandardItem, QDesktopServices, QIcon, ) -from PyQt5.QtCore import ( QLibraryInfo, QUrl, QItemSelectionModel ) +from PyQt5.QtCore import ( QLibraryInfo, QUrl, QItemSelectionModel, QFileInfo ) from PyQt5 import QtCore # , Qt, QThread, QObject, pyqtSignal) import sys try: @@ -402,7 +402,12 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): self.password=params.value("password", type="QString") self.destination=params.value("destination", type="QString") self.bwl=params.value("bwl",type=int) - self.localDirLabel.setText(self.tr("Local directory: ")+self.destination) + dest = QFileInfo(self.destination) + if dest.exists() and dest.isDir(): + self.localDirLabel.setText(self.tr("Local directory: ")+self.destination) + else: + #; {} is the placeholder the directory anme + self.localDirLabel.setText(self.tr("/!\ Local directory {} doesn't exists or isn't accessible. Check mounts or settings.").format(self.destination)) if self.location !="": self.remoteDirLabel.setText(self.tr("Remote directory: ")+self.location) @@ -530,6 +535,10 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): l = QDesktopServices.openUrl(QUrl('https://wiki.mageia.org/en/ISO_testing_rsync_tools')) def launchSync(self): + dest = QFileInfo(self.destination) + if (not dest.exists()) or (not dest.isDir()): + self.lvMessage(self.tr("/!\ Local directory {} doesn't exists or isn't accessible. Check mounts or settings.").format(self.destination)) + return self.IprogressBar.setEnabled(True) self.stop.setEnabled(True) self.syncGo.setEnabled(False) |