Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fully portable TraktRater #131

Open
nidunc opened this issue Jun 12, 2021 · 1 comment
Open

Fully portable TraktRater #131

nidunc opened this issue Jun 12, 2021 · 1 comment

Comments

@nidunc
Copy link

nidunc commented Jun 12, 2021

Currently, TraktRater stores its settings and logs in %APPDATA%\TraktRater (C:\Users\%USERNAME%\AppData\Roaming\TraktRater by default). This behaviour is hardcoded into the program in those files:

return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"TraktRater", @"Settings.xml");
internal static readonly string LogDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"TraktRater", @"Logs");

This means that TraktRater is not completely portable. While the executable itself can easily be put on a portable storage medium and run as-is on multiple computers (since it does not have to be installed), its settings won’t carry over, so—for example—one would have to re-authenticate to Trakt on every computer (unless one manually copies TraktRater’s AppData\Roaming folder to the other computers).

Especially given that TraktRater is already partially portable, due to the fact that the executable can be run directly without having to install it, in my opinion it would make sense to go all the way and make its settings (and logs/etc.) portable too; i.e., that TraktRater stores them in the same folder as the executable (or perhaps in a subfolder).
This could either be the default behaviour (falling back to the old way if %APPDATA%\TraktRater already exists), or you could add an argument/option that makes TraktRater fully portable when used while executing the executable (e.g., TraktRater_v2.3.10.exe --portable and/or TraktRater_v2.3.10.exe -p).

Would it be possible to implement this?

(Another way to achieve this would be to add an argument --configdir which could have a relative [e.g., TraktRater_v2.3.10.exe --configdir .] or an absolute path [e.g., TraktRater_v2.3.10.exe --configdir "C:\Programs\TraktRater"], but that may be unnecessarily complex. It would be handy for people who manage multiple accounts one one of the supported services, though, but that is outside of the scope of this issue.)


Current file structure (assuming that TraktRater_v2.3.10.exe is placed in C:\Programs\TraktRater)

C
├── Programs
│   └── TraktRater
│       └── TraktRater_v2.3.10.exe
└── Users
    └── %USERNAME%
        └── AppData
            └── Roaming
                └── TraktRater
                    ├── Logs
                    └── Settings.xml

Example of desired file structure (either by default or by running TraktRater_v2.3.10.exe with, e.g., the --portable and/or -p argument)

C
└── Programs
    └── TraktRater
        ├── Logs
        ├── TraktRater_v2.3.10.exe [--portable, -p]
        └── Settings.xml
@damienhaynes
Copy link
Owner

@nidunc Thanks for the detailed post, I do like this idea. I don't see anything preventing me from doing this.

If I make it portable by default, I will probably add an upgrade step to move the existing settings/logs to the current working directory. There will need to be a check whether or not the directory supports writes and if not, fall back to the old path where it should always be safe to write too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants