Skip to content

Commit

Permalink
fix create_config_folder not compatible with non-ansi paths (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
epessoa-i authored Oct 9, 2024
1 parent 3189fe0 commit 012a7f4
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/obs-utils/obs-config-utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,17 @@
#include <obs-module.h>
#include <util/config-file.h>
#include <filesystem>
#include <util/platform.h>

void create_config_folder()
{
char *config_folder_path = obs_module_config_path("");
if (config_folder_path == nullptr) {
char *config_folder_path = obs_module_config_path(NULL);
if (!config_folder_path) {
obs_log(LOG_ERROR, "Failed to get config folder path");
return;
}
std::filesystem::path config_folder_std_path(config_folder_path);
os_mkdirs(config_folder_path);
bfree(config_folder_path);

// create the folder if it doesn't exist
if (!std::filesystem::exists(config_folder_std_path)) {
#ifdef _WIN32
obs_log(LOG_INFO, "Config folder does not exist, creating: %S",
config_folder_std_path.c_str());
#else
obs_log(LOG_INFO, "Config folder does not exist, creating: %s",
config_folder_std_path.c_str());
#endif
// Create the config folder
std::filesystem::create_directories(config_folder_std_path);
}
}

int getConfig(config_t **config)
Expand Down

0 comments on commit 012a7f4

Please sign in to comment.