Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Nov 14, 2024
1 parent 9dbb08c commit c971b89
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions ovos_workshop/resource_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit c971b89

Please sign in to comment.