path improvements/fixes:

- replace more std::wstring with Native or VfsPath; wstring_from_utf8 ->
NativePathFromString
- replace sequences of Join(Path(), Basename+extension) with
ChangeExtension in wsdl, CacheLoader
- add Path::IsDirectory to replace .empty() / path_is_dir_sep(.back()).
also changed behavior to reflect the fact that "" is the VFS root
_directory_
- Path::Join now allows 2 identical path types (e.g. VfsPath) or one
char* literal (prevents inadvertently introducing non-safe characters).
to convert from wstring or wchar_t, use an explicit ctor (e.g.
VfsPath(wchar_t_string))

This was SVN commit r9091.
This commit is contained in:
janwas
2011-03-21 19:54:08 +00:00
parent 6d25329412
commit c3405e6f50
57 changed files with 179 additions and 165 deletions
+2 -2
View File
@@ -96,7 +96,7 @@ NativePath DataDir()
{
NativePath path;
TS_ASSERT_OK(sys_get_executable_name(path));
return Path::Join(Path::Path(path), L"../data");
return Path::Join(Path::Path(path), "../data");
}
// Script-based testing setup:
@@ -115,7 +115,7 @@ void ScriptTestSetup(ScriptInterface& ifc)
// Load the TS_* function definitions
// (We don't use VFS because tests might not have the normal VFS paths loaded)
NativePath path = Path::Join(DataDir(), L"tests/test_setup.js");
NativePath path = Path::Join(DataDir(), "tests/test_setup.js");
std::ifstream ifs(StringFromNativePath(path).c_str());
debug_assert(ifs.good());
std::string content((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());