TraktRater
TraktRater copied to clipboard
Fully portable TraktRater
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: https://github.com/damienhaynes/TraktRater/blob/abf8155e90df5ef55e6a7dc49ecfb40f9fd9c436/Settings/Settings.cs#L163 https://github.com/damienhaynes/TraktRater/blob/abf8155e90df5ef55e6a7dc49ecfb40f9fd9c436/Logger/FileLog.cs#L14
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
@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.