mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-02 04:20:16 +00:00
[linux] Use $XDG_CONFIG_HOME if defined instead of $HOME/.config (fix #2332)
This commit is contained in:
parent
f1b02a3347
commit
64f96f0851
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2019 Igara Studio S.A.
|
// Copyright (C) 2018-2021 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -81,7 +81,7 @@ ConfigModule::ConfigModule()
|
|||||||
#elif !defined(_WIN32)
|
#elif !defined(_WIN32)
|
||||||
|
|
||||||
// On Linux we migrate the old configuration file name
|
// On Linux we migrate the old configuration file name
|
||||||
// (.asepriterc -> ~/.config/aseprite/aseprite.ini)
|
// (~/.asepriterc -> ~/.config/aseprite/aseprite.ini)
|
||||||
{
|
{
|
||||||
ResourceFinder old_rf;
|
ResourceFinder old_rf;
|
||||||
old_rf.includeHomeDir(".asepriterc");
|
old_rf.includeHomeDir(".asepriterc");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
// Copyright (C) 2019-2021 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -105,8 +105,8 @@ void ResourceFinder::includeDataDir(const char* filename)
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
// $HOME/.config/aseprite/filename
|
// $HOME/.config/aseprite/filename
|
||||||
sprintf(buf, ".config/aseprite/data/%s", filename);
|
sprintf(buf, "aseprite/data/%s", filename);
|
||||||
includeHomeDir(buf);
|
includeHomeConfigDir(buf);
|
||||||
|
|
||||||
// $BINDIR/data/filename
|
// $BINDIR/data/filename
|
||||||
sprintf(buf, "data/%s", filename);
|
sprintf(buf, "data/%s", filename);
|
||||||
@ -150,6 +150,24 @@ void ResourceFinder::includeHomeDir(const char* filename)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||||
|
|
||||||
|
// For Linux: It's $XDG_CONFIG_HOME or $HOME/.config
|
||||||
|
void ResourceFinder::includeHomeConfigDir(const char* filename)
|
||||||
|
{
|
||||||
|
char* configHome = std::getenv("XDG_CONFIG_HOME");
|
||||||
|
if (configHome && *configHome) {
|
||||||
|
// $XDG_CONFIG_HOME/filename
|
||||||
|
addPath(base::join_path(configHome, filename));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// $HOME/.config/filename
|
||||||
|
includeHomeDir(base::join_path(std::string(".config"), filename).c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !defined(_WIN32) && !defined(__APPLE__)
|
||||||
|
|
||||||
void ResourceFinder::includeUserDir(const char* filename)
|
void ResourceFinder::includeUserDir(const char* filename)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -185,7 +203,7 @@ void ResourceFinder::includeUserDir(const char* filename)
|
|||||||
#else // !__APPLE__
|
#else // !__APPLE__
|
||||||
|
|
||||||
// $HOME/.config/aseprite/filename
|
// $HOME/.config/aseprite/filename
|
||||||
includeHomeDir((std::string(".config/aseprite/") + filename).c_str());
|
includeHomeConfigDir((std::string("aseprite/") + filename).c_str());
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
// Copyright (C) 2019-2021 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -42,6 +42,11 @@ namespace app {
|
|||||||
void includeDataDir(const char* filename);
|
void includeDataDir(const char* filename);
|
||||||
void includeHomeDir(const char* filename);
|
void includeHomeDir(const char* filename);
|
||||||
|
|
||||||
|
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||||
|
// For Linux: It's $XDG_CONFIG_HOME or $HOME/.config
|
||||||
|
void includeHomeConfigDir(const char* filename);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Tries to add the given filename in these locations:
|
// Tries to add the given filename in these locations:
|
||||||
// For Windows:
|
// For Windows:
|
||||||
// - If ASEPRITE_USER_FOLDER environment variable is defined, it
|
// - If ASEPRITE_USER_FOLDER environment variable is defined, it
|
||||||
|
Loading…
x
Reference in New Issue
Block a user