diff --git a/ovos_workshop/resource_files.py b/ovos_workshop/resource_files.py index 952e18d..454374d 100644 --- a/ovos_workshop/resource_files.py +++ b/ovos_workshop/resource_files.py @@ -256,12 +256,18 @@ def locate_base_directory(self, skill_directory: str) -> Optional[str]: return # check for lang resources shipped by the skill - possible_directories = ( - Path(skill_directory, "locale", self.language), - Path(skill_directory, resource_subdirectory, self.language), - Path(skill_directory, resource_subdirectory), - Path(skill_directory, "text", self.language), - ) + if resource_subdirectory: + possible_directories = ( + Path(skill_directory, "locale", self.language), + Path(skill_directory, resource_subdirectory, self.language), + Path(skill_directory, resource_subdirectory), + Path(skill_directory, "text", self.language), + ) + else: + possible_directories = ( + Path(skill_directory, "locale", self.language), + Path(skill_directory, "text", self.language), + ) for directory in possible_directories: if directory.exists(): self.base_directory = directory @@ -281,7 +287,7 @@ def locate_base_directory(self, skill_directory: str) -> Optional[str]: if self.user_directory: self.base_directory = self.user_directory - def _get_resource_subdirectory(self) -> str: + def _get_resource_subdirectory(self) -> Optional[str]: """Returns the subdirectory for this resource type. In the older directory schemes, several resource types were stored @@ -297,10 +303,10 @@ def _get_resource_subdirectory(self) -> str: template="dialog", vocab="vocab", word="dialog", - qml="ui" + qml="gui" ) - return subdirectories[self.resource_type] + return subdirectories.get(self.resource_type) class ResourceFile: @@ -657,7 +663,7 @@ def _define_resource_types(self) -> SkillResourceTypes: vocabulary=ResourceType("vocab", ".voc", self.language), word=ResourceType("word", ".word", self.language), qml=ResourceType("qml", ".qml"), - json=ResourceType("json", ".json") + json=ResourceType("json", ".json", self.language) ) for resource_type in resource_types.values(): if self.skill_id: