This commit is contained in:
Бранимир Караџић 2024-06-15 16:53:08 -07:00
parent d1feabe319
commit acfad63e8f
1 changed files with 19 additions and 14 deletions

View File

@ -87,10 +87,15 @@ public:
bx::StringView next() bx::StringView next()
{ {
bx::StringView result = m_token; bx::StringView result = m_token;
m_token = bx::strTrim( m_token = bx::strTrim(
bx::StringView(m_token.getTerm()+1, bx::strFind(bx::StringView(m_token.getTerm()+1, m_str.getTerm() ), m_ch).getPtr() ) bx::StringView(
m_token.getTerm()+1
, bx::strFind(bx::StringView(m_token.getTerm()+1, m_str.getTerm() ), m_ch).getPtr()
)
, " \t\n" , " \t\n"
); );
return result; return result;
} }
@ -124,11 +129,12 @@ bool openFileSelectionDialog(
, const bx::StringView& _filter , const bx::StringView& _filter
) )
{ {
#if BX_PLATFORM_LINUX bx::Error err;
char tmp[4096]; char tmp[4096];
bx::StaticMemoryBlockWriter writer(tmp, sizeof(tmp) ); bx::StaticMemoryBlockWriter writer(tmp, sizeof(tmp) );
bx::Error err; #if BX_PLATFORM_LINUX
bx::write(&writer, &err bx::write(&writer, &err
, "--file-selection%s --title \"%.*s\" --filename \"%s\"" , "--file-selection%s --title \"%.*s\" --filename \"%s\""
, FileSelectionDialogType::Save == _type ? " --save" : "" , FileSelectionDialogType::Save == _type ? " --save" : ""
@ -167,9 +173,13 @@ bool openFileSelectionDialog(
} }
} }
} }
#elif BX_PLATFORM_WINDOWS #elif BX_PLATFORM_WINDOWS
if (_type < 0 || _type >= BX_COUNTOF(s_getFileNameA)) if (_type < 0
|| _type >= BX_COUNTOF(s_getFileNameA) )
{
return false; return false;
}
char out[bx::kMaxFilePath] = { '\0' }; char out[bx::kMaxFilePath] = { '\0' };
@ -181,11 +191,6 @@ bool openFileSelectionDialog(
ofn.maxFile = sizeof(out); ofn.maxFile = sizeof(out);
ofn.flags = s_getFileNameA[_type].m_flags; ofn.flags = s_getFileNameA[_type].m_flags;
char tmp[4096];
bx::StaticMemoryBlockWriter writer(tmp, sizeof(tmp) );
bx::Error err;
ofn.title = tmp; ofn.title = tmp;
bx::write(&writer, &err, "%.*s", _title.getLength(), _title.getPtr() ); bx::write(&writer, &err, "%.*s", _title.getLength(), _title.getPtr() );
bx::write(&writer, '\0', &err); bx::write(&writer, '\0', &err);
@ -229,13 +234,13 @@ bool openFileSelectionDialog(
bx::write(&writer, '\0', &err); bx::write(&writer, '\0', &err);
if (err.isOk() if (err.isOk()
&& s_getFileNameA[_type].m_function(&ofn)) && s_getFileNameA[_type].m_function(&ofn) )
{ {
_inOutFilePath.set(ofn.file); _inOutFilePath.set(ofn.file);
return true; return true;
} }
#else #else
BX_UNUSED(_inOutFilePath, _type, _title, _filter); BX_UNUSED(_inOutFilePath, _type, _title, _filter, err, tmp, writer);
#endif // BX_PLATFORM_LINUX #endif // BX_PLATFORM_LINUX
return false; return false;