arcusmaximus / YTSubConverter

A tool for creating styled YouTube subtitles
MIT License
767 stars 55 forks source link

Storing style options inside the program's installation directory is a problem for system-wide installations #64

Closed layercak3 closed 2 years ago

layercak3 commented 2 years ago

Version: 52cbcc8224a4bc0f5cf8e784bdb0e29554274ce8 OS: Linux

Currently, style options are stored in StyleOptions.xml inside the program's installation directory. It's updated when the program exits. This is fine for a portable installation, but it is a problem in system-wide installations, such as installing to a ProgramFiles directory in Windows or if being packaged by a package manager which is common in traditional Linux distributions. YTSubConverter's installation directory will not be writable, and even if write access is given to the StyleOptions.xml file for all users, in a system-wide installation it means that different users would be sharing the StyleOptions.xml file.

Instead, style options could be stored per-user in the user's configuration directory. For example, in AppData or something along the lines of that on Windows, whatever the macOS equivalent is, and ~/.config/YTSubConverter on Linux. This fixes all the problems in a system-wide installation. But that file would no longer be 'portable' if used in a portable installation, so that could be potentially addressed by always using the StyleOptions.xml file in the program's install directory if it exists and is writable. mpv (look under the FILES ON WINDOWS heading) does something similar.

arcusmaximus commented 2 years ago

Changed the Linux version as suggested: configuration file in the user's home directory, unless it already exists in the application directory from a previous release.

On Windows, the converter is very much meant to be a small, single-file, portable utility that you just throw in any folder you like (such as right next to your subtitle files). On macOS, the "YTSubConverter.app" that goes in the system's Applications folder is (despite the extension) not a file but a folder, and is writable. As such, I'll leave those versions as they are.