diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plSrtFileReader.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plSrtFileReader.cpp index 19e5f688..01b53088 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plSrtFileReader.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plSrtFileReader.cpp @@ -54,24 +54,17 @@ static const std::regex timingsRegex("^(\\d{2}):(\\d{2}):(\\d{2}),(\\d{3}) --> ( bool plSrtFileReader::ReadFile() { - char path[MAX_PATH]; - - if (strchr(fAudioFileName, '\\') != nil) - strcpy(path, fAudioFileName); - else - sprintf(path, "sfx\\%s", fAudioFileName); - - wchar srtPathUnicode[MAX_PATH]; - StrToUnicode(srtPathUnicode, path, arrsize(srtPathUnicode)); - PathSetExtension(srtPathUnicode, srtPathUnicode, L".sub", arrsize(srtPathUnicode)); + wchar path[MAX_PATH]; + StrPrintf(path, arrsize(path), L"sfx\\%S", fAudioFileName); + PathSetExtension(path, path, L".sub", arrsize(path)); - if (PathDoesFileExist(srtPathUnicode)) { + if (PathDoesFileExist(path)) { // read sets of SRT data until end of file hsUNIXStream srtFileStream; // if file exists and was opened successfully - if (srtFileStream.Open(srtPathUnicode, L"r")) { - plStatusLog::AddLineS("audio.log", "Successfully opened subtitle file {}", srtPathUnicode); + if (srtFileStream.Open(path, L"r")) { + plStatusLog::AddLineS("audio.log", "Successfully opened subtitle file {}", path); uint32_t subtitleNumber = 0; uint32_t subtitleStartTimeMs = 0;