mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-25 03:32:16 +00:00
Update handling for CD property creation, and deletion (#326)
This commit is contained in:
parent
992095ffd5
commit
156367a827
@ -213,9 +213,13 @@ def drive_cdrom():
|
|||||||
file_name = request.form.get("file_name")
|
file_name = request.form.get("file_name")
|
||||||
|
|
||||||
# Creating the drive properties file
|
# Creating the drive properties file
|
||||||
from pathlib import Path
|
file_name = f"{file_name}.{PROPERTIES_SUFFIX}"
|
||||||
file_name = str(Path(file_name).stem) + "." + PROPERTIES_SUFFIX
|
properties = {
|
||||||
properties = {"vendor": vendor, "product": product, "revision": revision, "block_size": block_size}
|
"vendor": vendor,
|
||||||
|
"product": product,
|
||||||
|
"revision": revision,
|
||||||
|
"block_size": block_size,
|
||||||
|
}
|
||||||
process = write_drive_properties(file_name, properties)
|
process = write_drive_properties(file_name, properties)
|
||||||
if process["status"] == True:
|
if process["status"] == True:
|
||||||
flash(f"Drive properties file {file_name} created")
|
flash(f"Drive properties file {file_name} created")
|
||||||
@ -597,15 +601,14 @@ def delete():
|
|||||||
|
|
||||||
# Delete the drive properties file, if it exists
|
# Delete the drive properties file, if it exists
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
file_name = str(Path(file_name).stem) + "." + PROPERTIES_SUFFIX
|
prop_file_path = f"{cfg_dir}{file_name}.{PROPERTIES_SUFFIX}"
|
||||||
file_path = Path(cfg_dir + file_name)
|
if Path(prop_file_path).is_file():
|
||||||
if file_path.is_file():
|
process = delete_file(prop_file_path)
|
||||||
process = delete_file(cfg_dir + file_name)
|
|
||||||
if process["status"] == True:
|
if process["status"] == True:
|
||||||
flash(f"File {file_name} deleted!")
|
flash(f"File {prop_file_path} deleted!")
|
||||||
return redirect(url_for("index"))
|
return redirect(url_for("index"))
|
||||||
else:
|
else:
|
||||||
flash(f"Failed to delete file {file_name}!", "error")
|
flash(f"Failed to delete file {prop_file_path}!", "error")
|
||||||
flash(process["msg"], "error")
|
flash(process["msg"], "error")
|
||||||
return redirect(url_for("index"))
|
return redirect(url_for("index"))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user