1
0
forked from 0ad/0ad

Fix build error in tests.

Don't call wrealpath on the value returned by GetArg0, since it breaks
the tests and changes the semantics of that function.

This was SVN commit r9427.
This commit is contained in:
Ykkrosh 2011-05-04 14:40:14 +00:00
parent b560ff5fb7
commit fa16181e84
2 changed files with 10 additions and 8 deletions

View File

@ -16,11 +16,9 @@
*/
#include "precompiled.h"
#include "CmdLineArgs.h"
#include "lib/sysdep/filesystem.h" // wrealpath
CmdLineArgs::CmdLineArgs(int argc, const char* argv[])
{
if (argc >= 1)
@ -29,7 +27,7 @@ CmdLineArgs::CmdLineArgs(int argc, const char* argv[])
// avoid OsPath complaining about mixing both types of separators,
// which happens when running in the VC2010 debugger
std::replace(arg0.begin(), arg0.end(), '\\', '/');
m_Arg0 = wrealpath(arg0);
m_Arg0 = arg0;
}
for (int i = 1; i < argc; ++i)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2009 Wildfire Games.
/* Copyright (C) 2011 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -19,7 +19,7 @@
#include "ps/GameSetup/CmdLineArgs.h"
class TestCmdLineArgs : public CxxTest::TestSuite
class TestCmdLineArgs : public CxxTest::TestSuite
{
public:
void test_has()
@ -78,9 +78,13 @@ public:
{
const char* argv[] = { "program" };
CmdLineArgs c(ARRAY_SIZE(argv), argv);
TS_ASSERT_STR_EQUALS(c.GetArg0(), "program");
TS_ASSERT_WSTR_EQUALS(c.GetArg0().string(), L"program");
CmdLineArgs c2(0, NULL);
TS_ASSERT_STR_EQUALS(c2.GetArg0(), "");
TS_ASSERT_WSTR_EQUALS(c2.GetArg0().string(), L"");
const char* argv3[] = { "ab/cd\\ef\\gh/../ij" };
CmdLineArgs c3(ARRAY_SIZE(argv3), argv3);
TS_ASSERT_WSTR_EQUALS(c3.GetArg0().string(), L"ab/cd/ef/gh/../ij");
}
};