From beddf562449e1c896e87200ae669fdcb508e3ed1 Mon Sep 17 00:00:00 2001 From: Papoteur Date: Sat, 25 Jul 2020 10:04:05 +0200 Subject: Add checking for existence of local destination directory (mga#26975) --- mageiaSync/mageiasync.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'mageiaSync') 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) -- cgit v1.2.1