themoeway / local-audio-yomichan

Anki add-on to run a local audio server for Yomichan.
MIT License
73 stars 10 forks source link

feat: use platform-specific paths when running as a standalone program #20

Closed musjj closed 5 months ago

musjj commented 6 months ago

The program now looks for the appropriate, native and platform-specific paths when reading/writing data and configuration. The user_files directory will still be used when running as an Anki plugin.

Example paths from a typical setup:

Most of the path logic is adapted from the platformdirs library.

Motivation

I wanted to distribute local-audio-yomichan as a standalone Linux package, but the non-standard path handling makes it hard to do that. Programs don't always have write access to the directory they live in, so this PR makes it so that data and configuration is stored in the appropriate, OS-compliant directories.

musjj commented 5 months ago

@Aquafina-water-bottle @djahandarie Hey, can anyone take a look at this PR? I've been using this for quite a bit now and it's working pretty well.

It also should be backwards-compatible to pretty much all Anki users.