Skip to content

Commit 9e48274

Browse files
derrodtt2468
authored andcommitted
Config: Ensure conversion to filesystem::path uses utf-8
1 parent 3b7c1c5 commit 9e48274

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Config.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ bool MigratePersistentData()
193193
std::error_code ec;
194194

195195
// Ensure module config directory exists
196-
std::string moduleConfigDirectory = Utils::Obs::StringHelper::GetModuleConfigPath("");
196+
auto moduleConfigDirectory = std::filesystem::u8path(Utils::Obs::StringHelper::GetModuleConfigPath(""));
197197
if (!std::filesystem::exists(moduleConfigDirectory, ec))
198198
std::filesystem::create_directories(moduleConfigDirectory, ec);
199199
if (ec) {
@@ -203,10 +203,11 @@ bool MigratePersistentData()
203203
}
204204

205205
// Move any existing persistent data to module config directory, then delete old file
206-
std::string oldPersistentDataPath =
207-
Utils::Obs::StringHelper::GetCurrentProfilePath() + "/../../../obsWebSocketPersistentData.json";
206+
auto oldPersistentDataPath = std::filesystem::u8path(Utils::Obs::StringHelper::GetCurrentProfilePath() +
207+
"/../../../obsWebSocketPersistentData.json");
208208
if (std::filesystem::exists(oldPersistentDataPath, ec)) {
209-
std::string persistentDataPath = Utils::Obs::StringHelper::GetModuleConfigPath("persistent_data.json");
209+
auto persistentDataPath =
210+
std::filesystem::u8path(Utils::Obs::StringHelper::GetModuleConfigPath("persistent_data.json"));
210211
std::filesystem::copy_file(oldPersistentDataPath, persistentDataPath, ec);
211212
std::filesystem::remove(oldPersistentDataPath, ec);
212213
blog(LOG_INFO, "[MigratePersistentData] Persistent data migrated to new path");

0 commit comments

Comments
 (0)