Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ArcLoader won't work without a top level directory #41

Open
alerque opened this issue Feb 16, 2023 · 3 comments
Open

ArcLoader won't work without a top level directory #41

alerque opened this issue Feb 16, 2023 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@alerque
Copy link
Contributor

alerque commented Feb 16, 2023

I spent a while trying to figure out why I was only getting panics trying to follow examples from the docs. I finally narrowed it down to this bit of code:

let arc = ArcLoader::builder("tests/locales", unic_langid::langid!("en-US"))

The path from this test tests/locales from the test and examples works, but using "./" or any other iteration I can think of to use $CWD to look for resources ends in a panic.

@XAMPPRocky
Copy link
Owner

Thank you for your issue! I don't have the time at the moment to fix this, but I would be able to review a PR and release a fix if someone can contribute a fix.

@XAMPPRocky XAMPPRocky added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Feb 16, 2023
@alerque
Copy link
Contributor Author

alerque commented Feb 16, 2023

I've tracked this down a bit more. The issue is not with being able to use CWD per say (although that does cause extra panics), it is also with the fact that the loader blindly assumes everything in the path given (even if it is "./locales" or similar) must be a valid locale tree and have valid Fluent resource files. It doesn't matter if the locales and resource files that you use are all fine, if one exists on the file system that isn't valid things go haywire.r

  • Any unparsable FTL file (even in an non-locale directory kept around as a test fixture) will make in panic.
  • Any directory present that wouldn't be a valid locale will panic.

@XAMPPRocky
Copy link
Owner

XAMPPRocky commented Feb 17, 2023

Thank you for investigating! Those errors make sense to me but they should probably not be panics and they should be more informative of what specifically is causing the problem.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants