mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Config: Ensure conversion to filesystem::path uses utf-8
This commit is contained in:
parent
3b7c1c5381
commit
9e48274617
@ -193,7 +193,7 @@ bool MigratePersistentData()
|
|||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
|
|
||||||
// Ensure module config directory exists
|
// Ensure module config directory exists
|
||||||
std::string moduleConfigDirectory = Utils::Obs::StringHelper::GetModuleConfigPath("");
|
auto moduleConfigDirectory = std::filesystem::u8path(Utils::Obs::StringHelper::GetModuleConfigPath(""));
|
||||||
if (!std::filesystem::exists(moduleConfigDirectory, ec))
|
if (!std::filesystem::exists(moduleConfigDirectory, ec))
|
||||||
std::filesystem::create_directories(moduleConfigDirectory, ec);
|
std::filesystem::create_directories(moduleConfigDirectory, ec);
|
||||||
if (ec) {
|
if (ec) {
|
||||||
@ -203,10 +203,11 @@ bool MigratePersistentData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move any existing persistent data to module config directory, then delete old file
|
// Move any existing persistent data to module config directory, then delete old file
|
||||||
std::string oldPersistentDataPath =
|
auto oldPersistentDataPath = std::filesystem::u8path(Utils::Obs::StringHelper::GetCurrentProfilePath() +
|
||||||
Utils::Obs::StringHelper::GetCurrentProfilePath() + "/../../../obsWebSocketPersistentData.json";
|
"/../../../obsWebSocketPersistentData.json");
|
||||||
if (std::filesystem::exists(oldPersistentDataPath, ec)) {
|
if (std::filesystem::exists(oldPersistentDataPath, ec)) {
|
||||||
std::string persistentDataPath = Utils::Obs::StringHelper::GetModuleConfigPath("persistent_data.json");
|
auto persistentDataPath =
|
||||||
|
std::filesystem::u8path(Utils::Obs::StringHelper::GetModuleConfigPath("persistent_data.json"));
|
||||||
std::filesystem::copy_file(oldPersistentDataPath, persistentDataPath, ec);
|
std::filesystem::copy_file(oldPersistentDataPath, persistentDataPath, ec);
|
||||||
std::filesystem::remove(oldPersistentDataPath, ec);
|
std::filesystem::remove(oldPersistentDataPath, ec);
|
||||||
blog(LOG_INFO, "[MigratePersistentData] Persistent data migrated to new path");
|
blog(LOG_INFO, "[MigratePersistentData] Persistent data migrated to new path");
|
||||||
|
Loading…
Reference in New Issue
Block a user