Programs often leave their files in a hidden folder in the user's home directory. The XDG Base Directory Specification details how this should be handled. The gist of it is that program files should be stored in specific locations based on how the program uses them, rather than storing all data in one place. Currently, pymobiledevice3 stores all files in ~/.pymobiledevice3.
This directory, for me, only contains one file, so I can't speak to how files should be organized without exploring beyond the needs of my use case. Ideally, config files would go in $XDG_CONFIG_HOME/pymobiledevice3, temporary/cached files in $XDG_CACHE_HOME/pymobiledevice3, and other files in $XDG_DATA_HOME/pymobiledevice3. However, it is somewhat common for programs just to migrate all of their files from ~/.program to $XDG_DATA_HOME/program, and, though this does not technically comply with the spec, it is, for neurotic people like me, preferable to having another dotfile in the home directory.
To remain backwards-compatible for those who already have data in ~/.pymobiledevice3, that directory should be checked for files before checking wherever the new file location winds up. If the various XDG variables are set, they should be used, and if they are not, then the defaults for those variables (.config, .cache, and .local/share) should be used.
After a quick peek at the source code, it seems like the only place that the .pymobiledevice3 directory is explicitly specified is here in common.py. If the approach of migrating everything to $XDG_DATA_HOME/pymobiledevice3 is taken, this change should be relatively straightforward. Properly sorting out which directory files should go in (if indeed there are config/cache files for other users which I have not used the program enough to generate) might require a more in-depth solution.
If nobody more familiar with the project has any desire to address this, I may circle back to do so myself when my schedule allows.
For community
⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment
Programs often leave their files in a hidden folder in the user's home directory. The XDG Base Directory Specification details how this should be handled. The gist of it is that program files should be stored in specific locations based on how the program uses them, rather than storing all data in one place. Currently, pymobiledevice3 stores all files in
~/.pymobiledevice3.This directory, for me, only contains one file, so I can't speak to how files should be organized without exploring beyond the needs of my use case. Ideally, config files would go in
$XDG_CONFIG_HOME/pymobiledevice3, temporary/cached files in$XDG_CACHE_HOME/pymobiledevice3, and other files in$XDG_DATA_HOME/pymobiledevice3. However, it is somewhat common for programs just to migrate all of their files from~/.programto$XDG_DATA_HOME/program, and, though this does not technically comply with the spec, it is, for neurotic people like me, preferable to having another dotfile in the home directory.To remain backwards-compatible for those who already have data in
~/.pymobiledevice3, that directory should be checked for files before checking wherever the new file location winds up. If the various XDG variables are set, they should be used, and if they are not, then the defaults for those variables (.config,.cache, and.local/share) should be used.After a quick peek at the source code, it seems like the only place that the
.pymobiledevice3directory is explicitly specified is here incommon.py. If the approach of migrating everything to$XDG_DATA_HOME/pymobiledevice3is taken, this change should be relatively straightforward. Properly sorting out which directory files should go in (if indeed there are config/cache files for other users which I have not used the program enough to generate) might require a more in-depth solution.If nobody more familiar with the project has any desire to address this, I may circle back to do so myself when my schedule allows.
For community
⬇️ Please click the 👍 reaction instead of leaving a
+1or 👍 comment