[68] fix for #1067

This commit is contained in:
meisnate12 2022-10-02 13:19:32 -04:00
parent a1ed06ca0a
commit 5c52d77464
3 changed files with 14 additions and 6 deletions

View file

@ -1 +1 @@
1.17.3-develop67
1.17.3-develop68

View file

@ -80,20 +80,27 @@ class DataFile:
if "/" in data:
if data.endswith(".yml"):
return data[data.rfind("/") + 1:-4]
elif data.endswith(".yaml"):
return data[data.rfind("/") + 1:-5]
else:
return data[data.rfind("/") + 1:]
elif "\\" in data:
if data.endswith(".yml"):
return data[data.rfind("\\") + 1:-4]
elif data.endswith(".yaml"):
return data[data.rfind("/") + 1:-5]
else:
return data[data.rfind("\\") + 1:]
else:
return data
def load_file(self, file_type, file_path, library_type=None, overlay=False, translation=False):
if translation and file_path.endswith(".yml"):
file_path = file_path[:-4]
if not translation and not file_path.endswith(".yml"):
if translation:
if file_path.endswith(".yml"):
file_path = file_path[:-4]
elif file_path.endswith(".yaml"):
file_path = file_path[:-5]
if not translation and not file_path.endswith((".yml", ".yaml")):
file_path = f"{file_path}.yml"
if file_type in ["URL", "Git", "Repo"]:
if file_type == "Repo" and not self.config.custom_repo:

View file

@ -440,11 +440,12 @@ def load_files(files_to_load, method, schedule=None, lib_vars=None):
elif not os.path.isdir(file["folder"]):
logger.error(f"Config Error: Folder not found: {file['folder']}")
else:
yml_files = glob_filter(os.path.join(file["folder"], f"*.yml"))
yml_files = glob_filter(os.path.join(file["folder"], "*.yml"))
yml_files.extend(glob_filter(os.path.join(file["folder"], "*.yaml")))
if yml_files:
current.extend([("File", yml, temp_vars, asset_directory) for yml in yml_files])
else:
logger.error(f"Config Error: No YAML (.yml) files found in {file['folder']}")
logger.error(f"Config Error: No YAML (.yml|.yaml) files found in {file['folder']}")
if schedule and "schedule" in file and file["schedule"]:
current_time, run_hour, ignore_schedules = schedule