mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
refactor path interface:
- use wrapper class instead of std::wstring (reduces mixing of strings/paths; allows safe+easy join via operator/ and convenient case-insensitive comparison via operator==, avoids NativePathFromString, similar to boost::filesystem) - NativePath -> OsPath - add hash and To/FromJSVal for Path - add TS_ASSERT_PATH_EQUALS - replace _wfopen_s with sys_OpenFile - remove obsolete SortFiles/Directories This was SVN commit r9107.
This commit is contained in:
@@ -257,33 +257,6 @@ int tsprintf_s(tchar* buf, size_t max_chars, const tchar* fmt, ...)
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
// note: there is no portable wfopen, so we need separate implementations
|
||||
// of tfopen_s. (the Unicode version just converts to UTF8)
|
||||
#if defined(WSECURE_CRT)
|
||||
|
||||
errno_t _wfopen_s(FILE** pfile, const wchar_t* filename, const wchar_t* mode)
|
||||
{
|
||||
*pfile = NULL;
|
||||
const std::string filename_c = utf8_from_wstring(filename);
|
||||
const std::string mode_c = utf8_from_wstring(mode);
|
||||
return fopen_s(pfile, filename_c.c_str(), mode_c.c_str());
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
errno_t fopen_s(FILE** pfile, const char* filename, const char* mode)
|
||||
{
|
||||
*pfile = NULL;
|
||||
FILE* file = fopen(filename, mode);
|
||||
if(!file)
|
||||
return ENOENT;
|
||||
*pfile = file;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // #if EMULATE_SECURE_CRT
|
||||
|
||||
#undef tchar
|
||||
|
||||
Reference in New Issue
Block a user