--xdg improvement

This commit is contained in:
longpanda 2022-04-24 20:14:26 +08:00
parent 33a562c273
commit 5eec535391
5 changed files with 20 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1318,6 +1318,16 @@ int main(int argc, char **argv)
snprintf(g_log_file, sizeof(g_log_file), "%s/ventoy.log", env);
touch_new_file(g_log_file);
}
else
{
env = getenv("HOME");
if (env && is_dir_exist("%s/.cache", env))
{
g_xdg_log = 1;
snprintf(g_log_file, sizeof(g_log_file), "%s/.cache/ventoy.log", env);
touch_new_file(g_log_file);
}
}
env = getenv("XDG_CONFIG_HOME");
if (env)
@ -1326,6 +1336,16 @@ int main(int argc, char **argv)
snprintf(g_ini_file, sizeof(g_ini_file), "%s/Ventoy2Disk.ini", env);
touch_new_file(g_ini_file);
}
else
{
env = getenv("HOME");
if (env && is_dir_exist("%s/.config", env))
{
g_xdg_ini = 1;
snprintf(g_ini_file, sizeof(g_ini_file), "%s/.config/Ventoy2Disk.ini", env);
touch_new_file(g_ini_file);
}
}
}
}