Made file paths and command line arguments UTF-8 on Windows. Fixes #438. (#449)

This commit is contained in:
Branimir Karadžić
2026-10-07 19:52:56 -07:00
committed by GitHub
parent f56519b35d
commit 3fd3d3279e
14 changed files with 730 additions and 81 deletions

View File

@@ -4,6 +4,7 @@
*/
#include "test.h"
#include <bx/allocator.h>
#include <bx/commandline.h>
#include <bx/readerwriter.h>
#include <bx/string.h>
@@ -436,3 +437,25 @@ TEST_CASE("tokenizeCommandLine maxArgvs", "")
REQUIRE(0 == bx::strCmp(argv[1], "b") );
REQUIRE(0 == bx::strCmp(next, "v g d") );
}
TEST_CASE("commandLine args", "")
{
bx::DefaultAllocator allocator;
const char* argv[] = { "program", "--flag" };
bx::CommandLineArgs args(&allocator, BX_COUNTOF(argv), argv);
REQUIRE(0 < args.getArgc() );
REQUIRE(args.getArgv() != (const char**)NULL);
if (BX_ENABLED(BX_PLATFORM_WINDOWS) )
{
// Taken from the process command line, so the program is this test executable.
REQUIRE(!bx::strFind(args.getArgv()[0], "bx.test").isEmpty() );
}
else
{
REQUIRE(BX_COUNTOF(argv) == args.getArgc() );
REQUIRE(argv == args.getArgv() );
}
}