test: add platform tests (#3514)

* test: add tr_getDefaultDownloadDir() tests

this also indirectly tests xdg and homedir

* test: add PlatformTest.defaultConfigDirEnv

* test: add PlatformTest.defaultConfigDirXdgConfig

test: add PlatformTest.defaultConfigDirXdgConfigHome

* test: add PlatformTest.webClientDirEnvClutch

test: add PlatformTest.webClientDirEnvTr

test: add PlatformTest.webClientDirXdgDataHome

* fixup! test: add PlatformTest.webClientDirEnvClutch

fix: win32 breakage
This commit is contained in:
Charles Kerr
2022-07-22 20:10:02 -05:00
committed by GitHub
parent 9bf2918ad0
commit 445aad56a0
15 changed files with 326 additions and 204 deletions

View File

@@ -94,9 +94,11 @@ int main(int argc, char** argv)
tr_formatter_speed_init(speed_K, _(speed_K_str), _(speed_M_str), _(speed_G_str), _(speed_T_str));
/* set up the config dir */
if (config_dir.empty())
if (std::empty(config_dir))
{
config_dir = tr_getDefaultConfigDir(AppConfigDirName);
auto* const default_config_dir = tr_getDefaultConfigDir(AppConfigDirName);
config_dir = default_config_dir;
tr_free(default_config_dir);
}
gtr_pref_init(config_dir);