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()
|
bool plSrtFileReader::ReadFile()
|
||||||
{
|
{
|
||||||
char path[MAX_PATH];
|
wchar path[MAX_PATH];
|
||||||
|
StrPrintf(path, arrsize(path), L"sfx\\%S", fAudioFileName);
|
||||||
if (strchr(fAudioFileName, '\\') != nil)
|
PathSetExtension(path, path, L".sub", arrsize(path));
|
||||||
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));
|
|
||||||
|
|
||||||
if (PathDoesFileExist(srtPathUnicode)) {
|
if (PathDoesFileExist(path)) {
|
||||||
// read sets of SRT data until end of file
|
// read sets of SRT data until end of file
|
||||||
hsUNIXStream srtFileStream;
|
hsUNIXStream srtFileStream;
|
||||||
|
|
||||||
// if file exists and was opened successfully
|
// if file exists and was opened successfully
|
||||||
if (srtFileStream.Open(srtPathUnicode, L"r")) {
|
if (srtFileStream.Open(path, L"r")) {
|
||||||
plStatusLog::AddLineS("audio.log", "Successfully opened subtitle file {}", srtPathUnicode);
|
plStatusLog::AddLineS("audio.log", "Successfully opened subtitle file {}", path);
|
||||||
|
|
||||||
uint32_t subtitleNumber = 0;
|
uint32_t subtitleNumber = 0;
|
||||||
uint32_t subtitleStartTimeMs = 0;
|
uint32_t subtitleStartTimeMs = 0;
|
||||||
|
Reference in New Issue
Block a user