mirror of
https://github.com/akuker/RASCSI.git
synced 2025-08-15 08:27:34 +00:00
Fixed unnecessary detach_all() when config file isn't read (#221)
* Translate code commends into English, removing redundant ones * - Translated all remaining Japanese code comments in src/raspberrypi/ to English, with the exception of cfilesystem.cpp|h - Removed some redundant comments where the context is obvious from the code - Fixed a few typos and mistakes * - Store only file path and name to configuration csv - Strip known non-file path strings when reading configuration csv (backwards compatibility) - Validate SCSI ID before attempting to attach a device * Add comment and TODO * Partial translation of cfilesystem.h * Move csv read/write logic into file_cmd.py * Load default.csv on rascsi-web startup * Add rudimentary error handling to config loading/saving * Implement a delete configuration csv file feature. Also rename the delete_image method to delete_file and made it take the full file patch as argument to be consistent with other file operation methods. * Catch the exception when attempting to exclude SCSI id that is already in use from a list of valid SCSI ids * Fix error handling when failing to open a csv file for read or write * Run detach_all() only after succeeding to open a file for reading
This commit is contained in:
@@ -106,11 +106,11 @@ def write_config_csv(file_name):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def read_config_csv(file_name):
|
def read_config_csv(file_name):
|
||||||
detach_all()
|
|
||||||
import csv
|
import csv
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(file_name) as csv_file:
|
with open(file_name) as csv_file:
|
||||||
|
detach_all()
|
||||||
config_reader = csv.reader(csv_file)
|
config_reader = csv.reader(csv_file)
|
||||||
#TODO: Remove hard-coded string sanitation (e.g. after implementing protobuf)
|
#TODO: Remove hard-coded string sanitation (e.g. after implementing protobuf)
|
||||||
exclude_list = ("X68000 HOST BRIDGE", "DaynaPort SCSI/Link", " (WRITEPROTECT)", "NO MEDIA")
|
exclude_list = ("X68000 HOST BRIDGE", "DaynaPort SCSI/Link", " (WRITEPROTECT)", "NO MEDIA")
|
||||||
|
Reference in New Issue
Block a user