优化文件路径处理逻辑,确保输入路径为目录
This commit is contained in:
@ -926,15 +926,18 @@ class Data:
|
||||
self.relate_point = None
|
||||
|
||||
def open_file(self):
|
||||
if Path(Config["Path"]["Input_orgBcg"]).is_file():
|
||||
Config["Path"]["Input_orgBcg"] = str(Path(Config["Path"]["Input_orgBcg"]).parent)
|
||||
|
||||
if not Path(Config["Path"]["Input_orgBcg"]).exists():
|
||||
return Result().failure(
|
||||
info=Constants.INPUT_FAILURE + "orgBcg: " + Constants.APPROXIMATELY_ALIGN_FAILURE_REASON[
|
||||
info=Constants.INPUT_FAILURE + "orgBcg: " + Config["Path"]["Input_orgBcg"] + Constants.APPROXIMATELY_ALIGN_FAILURE_REASON[
|
||||
"Data_Path_Not_Exist"])
|
||||
temp_orgBcg_path = list(
|
||||
Path(Config["Path"]["Input_orgBcg"]).glob(f"{ConfigParams.APPROXIMATELY_ALIGN_INPUT_ORGBCG_FILENAME}*"))
|
||||
if len(temp_orgBcg_path) == 0:
|
||||
return Result().failure(
|
||||
info=Constants.INPUT_FAILURE + "orgBcg: " + Constants.APPROXIMATELY_ALIGN_FAILURE_REASON[
|
||||
info=Constants.INPUT_FAILURE + "orgBcg: " + Config["Path"]["Input_orgBcg"] + Constants.APPROXIMATELY_ALIGN_FAILURE_REASON[
|
||||
"Data_File_Not_Exist"])
|
||||
elif len(temp_orgBcg_path) > 1:
|
||||
return Result().failure(
|
||||
@ -950,6 +953,8 @@ class Data:
|
||||
info=Constants.INPUT_FAILURE + "orgBcg: " + Constants.APPROXIMATELY_ALIGN_FAILURE_REASON[
|
||||
"Data_Frequency_Not_In_Filename"])
|
||||
Config["InputConfig"]["orgBcgFreq"] = int(orgBcg_freq)
|
||||
if Path(Config["Path"]["Input_Tho"]).is_file():
|
||||
Config["Path"]["Input_Tho"] = str(Path(Config["Path"]["Input_Tho"]).parent)
|
||||
|
||||
if not Path(Config["Path"]["Input_Tho"]).exists():
|
||||
return Result().failure(
|
||||
@ -976,6 +981,8 @@ class Data:
|
||||
"Data_Frequency_Not_In_Filename"])
|
||||
Config["InputConfig"]["ThoFreq"] = int(tho_freq)
|
||||
|
||||
if Path(Config["Path"]["Input_Abd"]).is_file():
|
||||
Config["Path"]["Input_Abd"] = str(Path(Config["Path"]["Input_Abd"]).parent)
|
||||
|
||||
if not Path(Config["Path"]["Input_Abd"]).exists():
|
||||
return Result().failure(
|
||||
|
||||
Reference in New Issue
Block a user