Fix issues when saving folder is not created
Some checks are pending
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux32 flags:32 name:Linux GCC 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux64 flags:64 name:Linux GCC x64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm32 flags:arm32 name:Linux GCC ARM 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm64 flags:arm64 name:Linux GCC ARM 64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:macos name:macOS Apple Silicon os:macos-14]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win32 flags:-A Win32 name:Windows VS2022 Win32 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win64 flags:-A x64 name:Windows VS2022 x64 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:winarm64 flags:-A ARM64 name:Windows VS2022 ARM os:windows-2022]) (push) Waiting to run
CD / Create Pi Mono Setup (push) Blocked by required conditions
CD / Publishing (push) Blocked by required conditions

This commit is contained in:
Lorenzooone
2024-11-10 04:41:04 +01:00
parent 3b84174212
commit d9df617d51
6 changed files with 62 additions and 39 deletions

View File

@@ -150,11 +150,12 @@ std::string LayoutNameGenerator(int index) {
return "layout" + std::to_string(index) + ".cfg";
}
std::string LayoutPathGenerator(int index) {
std::string LayoutPathGenerator(int index, bool created_proper_folder) {
bool success = false;
std::string cfg_dir;
#if !(defined(_WIN32) || defined(_WIN64))
if(const char* env_p = std::getenv("HOME")) {
const char* env_p = std::getenv("HOME");
if(created_proper_folder && env_p) {
cfg_dir = std::string(env_p) + "/.config/" + std::string(NAME);
success = true;
}
@@ -166,13 +167,13 @@ std::string LayoutPathGenerator(int index) {
return cfg_dir + "/presets/";
}
std::string load_layout_name(int index, bool &success) {
std::string load_layout_name(int index, bool created_proper_folder, bool &success) {
if(index == STARTUP_FILE_INDEX) {
success = true;
return "Initial";
}
std::string name = LayoutNameGenerator(index);
std::string path = LayoutPathGenerator(index);
std::string path = LayoutPathGenerator(index, created_proper_folder);
std::ifstream file(path + name);
std::string line;
@@ -425,4 +426,4 @@ bool SharedConsumerMutex::specific_try_lock(int index) {
}
access_mutex.unlock();
return success;
}
}