mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Simplify SRT file path construction with suggestion from Hoikas
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user