From 728f98ff6cf38ee7ca57259857c3dda654cc6d50 Mon Sep 17 00:00:00 2001 From: Nikhil Narayana Date: Fri, 29 Sep 2023 21:22:42 -0700 Subject: [PATCH] fix: linux user dir path --- Source/Core/Common/CommonPaths.h | 3 +- Source/Core/UICommon/CommandLineParse.cpp | 12 ++--- Source/Core/UICommon/UICommon.cpp | 62 +++++++++++++---------- build-appimage.sh | 2 +- 4 files changed, 45 insertions(+), 34 deletions(-) mode change 100644 => 100755 build-appimage.sh diff --git a/Source/Core/Common/CommonPaths.h b/Source/Core/Common/CommonPaths.h index fdc89e854a27..7ff98e3d9964 100644 --- a/Source/Core/Common/CommonPaths.h +++ b/Source/Core/Common/CommonPaths.h @@ -21,7 +21,8 @@ #else #define USERDATA_DIR "user" #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" #endif #else // ifndef STEAM diff --git a/Source/Core/UICommon/CommandLineParse.cpp b/Source/Core/UICommon/CommandLineParse.cpp index 7eb82653b438..6584f83210dc 100644 --- a/Source/Core/UICommon/CommandLineParse.cpp +++ b/Source/Core/UICommon/CommandLineParse.cpp @@ -123,13 +123,13 @@ std::unique_ptr CreateParser(ParserOptions options) .help("Choose audio emulation from [%choices]"); #ifdef IS_PLAYBACK parser->add_option("-i", "--slippi_input") - .action("store") - .metavar("") - .type("string") - .help("Path to Slippi replay config file (default: Slippi/playback.txt)"); + .action("store") + .metavar("") + .type("string") + .help("Path to Slippi replay config file (default: Slippi/playback.txt)"); parser->add_option("--hide-seekbar") - .action("store_true") - .help("Disable and hide seekbar during playback"); + .action("store_true") + .help("Disable and hide seekbar during playback"); #endif return parser; diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp index 9df6b70ef34a..91728746cf16 100644 --- a/Source/Core/UICommon/UICommon.cpp +++ b/Source/Core/UICommon/UICommon.cpp @@ -464,32 +464,42 @@ void SetUserDirectory(std::string custom_path) #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"); - std::string config_path = - std::string(config_home && config_home[0] == '/' ? config_home : - (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; - } + const char* config_home = getenv("XDG_CONFIG_HOME"); +#ifndef IS_PLAYBACK + const auto config_dir_name = NETPLAY_USER_DIR; +#else + 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; + + // 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"); + // std::string config_path = + // std::string(config_home && config_home[0] == '/' ? config_home : + // (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 diff --git a/build-appimage.sh b/build-appimage.sh old mode 100644 new mode 100755 index 4b68367d8709..f983ad274483 --- a/build-appimage.sh +++ b/build-appimage.sh @@ -1,7 +1,7 @@ #!/bin/bash -e # 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" LINUXDEPLOY_PATH="https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous"