fix: linux user dir path

This commit is contained in:
Nikhil Narayana 2023-09-29 21:22:42 -07:00
commit 728f98ff6c
No known key found for this signature in database
GPG key ID: 2D6E647B8732451F
4 changed files with 41 additions and 30 deletions

View file

@ -21,7 +21,8 @@
#else #else
#define USERDATA_DIR "user" #define USERDATA_DIR "user"
#define DOLPHIN_DATA_DIR "SlippiOnline" #define DOLPHIN_DATA_DIR "SlippiOnline"
#define PLAYBACK_DATA_DIR "SlippiPlayback" #define NETPLAY_USER_DIR "slippi-netplay-beta"
#define PLAYBACK_USER_DIR "slippi-playback-beta"
#define NORMAL_USER_DIR "dolphin-emu" #define NORMAL_USER_DIR "dolphin-emu"
#endif #endif
#else // ifndef STEAM #else // ifndef STEAM

View file

@ -464,32 +464,42 @@ void SetUserDirectory(std::string custom_path)
#else #else
else else
{ {
user_path = home_path + "." NORMAL_USER_DIR DIR_SEP;
if (!File::Exists(user_path))
{
const char* data_home = getenv("XDG_DATA_HOME");
std::string data_path =
std::string(data_home && data_home[0] == '/' ? data_home :
(home_path + ".local" DIR_SEP "share")) +
DIR_SEP NORMAL_USER_DIR DIR_SEP;
const char* config_home = getenv("XDG_CONFIG_HOME"); const char* config_home = getenv("XDG_CONFIG_HOME");
std::string config_path = #ifndef IS_PLAYBACK
std::string(config_home && config_home[0] == '/' ? config_home : const auto config_dir_name = NETPLAY_USER_DIR;
(home_path + ".config")) + #else
DIR_SEP NORMAL_USER_DIR DIR_SEP; const auto config_dir_name = PLAYBACK_USER_DIR;
#endif
const auto config_path =
std::string(config_home && config_home[0] == '/' ? config_home : (home_path + ".config"));
user_path = config_path + DIR_SEP + config_dir_name + DIR_SEP;
// user_path = home_path + "." NORMAL_USER_DIR DIR_SEP;
const char* cache_home = getenv("XDG_CACHE_HOME"); // if (!File::Exists(user_path))
std::string cache_path = // {
std::string(cache_home && cache_home[0] == '/' ? cache_home : (home_path + ".cache")) + // const char* data_home = getenv("XDG_DATA_HOME");
DIR_SEP NORMAL_USER_DIR DIR_SEP; // std::string data_path =
// std::string(data_home && data_home[0] == '/' ? data_home :
// (home_path + ".local" DIR_SEP
// "share")) +
// DIR_SEP NORMAL_USER_DIR DIR_SEP;
File::SetUserPath(D_USER_IDX, data_path); // const char* config_home = getenv("XDG_CONFIG_HOME");
File::SetUserPath(D_CONFIG_IDX, config_path); // std::string config_path =
File::SetUserPath(D_CACHE_IDX, cache_path); // std::string(config_home && config_home[0] == '/' ? config_home :
return; // (home_path + ".config")) +
} // DIR_SEP NORMAL_USER_DIR DIR_SEP;
// const char* cache_home = getenv("XDG_CACHE_HOME");
// std::string cache_path =
// std::string(cache_home && cache_home[0] == '/' ? cache_home : (home_path + ".cache"))
// + DIR_SEP NORMAL_USER_DIR DIR_SEP;
// File::SetUserPath(D_USER_IDX, data_path);
// File::SetUserPath(D_CONFIG_IDX, config_path);
// File::SetUserPath(D_CACHE_IDX, cache_path);
// return;
// }
} }
#endif #endif
#endif #endif

2
build-appimage.sh Normal file → Executable file
View file

@ -1,7 +1,7 @@
#!/bin/bash -e #!/bin/bash -e
# build-appimage.sh # build-appimage.sh
NETPLAY_APPIMAGE_STRING="Slippi_Online_Mainline-x86_64.AppImage" NETPLAY_APPIMAGE_STRING="Slippi_Netplay_Mainline-x86_64.AppImage"
PLAYBACK_APPIMAGE_STRING="Slippi_Playback_Mainline-x86_64.AppImage" PLAYBACK_APPIMAGE_STRING="Slippi_Playback_Mainline-x86_64.AppImage"
LINUXDEPLOY_PATH="https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous" LINUXDEPLOY_PATH="https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous"