add a path is writeable check to the restore function
This commit is contained in:
parent
52d7215094
commit
48e5f28cf3
|
@ -47,3 +47,10 @@ def create_path(path):
|
|||
def remove_path(path):
|
||||
if os.path.exists(path):
|
||||
shutil.rmtree(path)
|
||||
|
||||
|
||||
def check_path(path):
|
||||
if os.access(path, os.W_OK):
|
||||
return True
|
||||
exception = Exception("The selected path isn't writeable!")
|
||||
show_error(exception)
|
||||
|
|
|
@ -8,7 +8,7 @@ from PyQt5.QtWidgets import (QMainWindow, QFileSystemModel, QFileDialog,
|
|||
|
||||
from config import Config
|
||||
from helper import (BorgException, show_error, convert_size, open_path,
|
||||
create_path, remove_path)
|
||||
create_path, remove_path, check_path)
|
||||
import borg_interface as borg
|
||||
from progress import ProgressDialog
|
||||
|
||||
|
@ -130,7 +130,7 @@ class MainWindow(QMainWindow):
|
|||
target_path = None
|
||||
show_error(error)
|
||||
|
||||
if target_path and archive_name:
|
||||
if check_path(target_path) and archive_name:
|
||||
try:
|
||||
restore_path = os.path.join(target_path, archive_name)
|
||||
create_path(restore_path)
|
||||
|
|
Loading…
Reference in New Issue