Closed musjj closed 7 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.
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:
C:\Users\foobar\AppData\Local\local-audio-yomichan
/home/foobar/.{local/share,config}/local-audio-yomichan
/Users/foobar/Library/Application Support/local-audio-yomichan
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.