forked from 0ad/0ad
Fix build errors.
Fix VFS root directory failing IsDirectory, which breaks the search for textures.xml. Fix incompatible change to loose cache name determination. This was SVN commit r9092.
This commit is contained in:
parent
c3405e6f50
commit
83271ec816
@ -53,6 +53,7 @@ struct TPhash
|
|||||||
return (*this)(a->m_Properties);
|
return (*this)(a->m_Properties);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TPequal_to
|
struct TPequal_to
|
||||||
: std::binary_function<CTextureProperties, CTextureProperties, bool>,
|
: std::binary_function<CTextureProperties, CTextureProperties, bool>,
|
||||||
std::binary_function<CTexturePtr, CTexturePtr, bool>
|
std::binary_function<CTexturePtr, CTexturePtr, bool>
|
||||||
|
@ -76,8 +76,8 @@ namespace Path {
|
|||||||
template<class Path_t>
|
template<class Path_t>
|
||||||
static inline bool IsDirectory(const Path_t& pathname)
|
static inline bool IsDirectory(const Path_t& pathname)
|
||||||
{
|
{
|
||||||
if(pathname.empty()) // (ensure back() is safe)
|
if(pathname.empty()) // (ensure length()-1 is safe)
|
||||||
return false; // (the VFS root directory is represented as an empty string)
|
return true; // (the VFS root directory is represented as an empty string)
|
||||||
|
|
||||||
// note: ideally, path strings would only contain '/' or even SYS_DIR_SEP.
|
// note: ideally, path strings would only contain '/' or even SYS_DIR_SEP.
|
||||||
// however, windows-specific code (e.g. the sound driver detection)
|
// however, windows-specific code (e.g. the sound driver detection)
|
||||||
@ -86,7 +86,7 @@ static inline bool IsDirectory(const Path_t& pathname)
|
|||||||
// also, the self-tests verify correct operation of such strings.
|
// also, the self-tests verify correct operation of such strings.
|
||||||
// it would be error-prone to only test the platform's separator
|
// it would be error-prone to only test the platform's separator
|
||||||
// strings there. hence, we allow all separators here.
|
// strings there. hence, we allow all separators here.
|
||||||
return pathname.back() == '/' || pathname.back() == '\\';
|
return pathname[pathname.length()-1] == '/' || pathname[pathname.length()-1] == '\\';
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Path_t>
|
template<class Path_t>
|
||||||
|
@ -237,7 +237,7 @@ LibError dir_watch_Poll(DirWatchNotifications& notifications)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DirWatch* dirWatch = (DirWatch*)polled_notifications[i].userdata;
|
DirWatch* dirWatch = (DirWatch*)polled_notifications[i].userdata;
|
||||||
NativePath pathname = Path::Join(dirWatch->path, polled_notifications[i].filename);
|
NativePath pathname = Path::Join(dirWatch->path, NativePathFromString(polled_notifications[i].filename));
|
||||||
notifications.push_back(DirWatchNotification(pathname, type));
|
notifications.push_back(DirWatchNotification(pathname, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ VfsPath CCacheLoader::LooseCachePath(const VfsPath& sourcePath, const MD5& initi
|
|||||||
digestPrefix << std::setfill(L'0') << std::setw(2) << (int)digest[i];
|
digestPrefix << std::setfill(L'0') << std::setw(2) << (int)digest[i];
|
||||||
|
|
||||||
// Construct the final path
|
// Construct the final path
|
||||||
return Path::Join("cache", Path::ChangeExtension(sourcePath, std::wstring(L".") + digestPrefix.str() + m_FileExtension));
|
return Path::Join("cache", Path::ChangeExtension(sourcePath, Path::Extension(sourcePath) + std::wstring(L".") + digestPrefix.str() + m_FileExtension));
|
||||||
|
|
||||||
// TODO: we should probably include the mod name, once that's possible (http://trac.wildfiregames.com/ticket/564)
|
// TODO: we should probably include the mod name, once that's possible (http://trac.wildfiregames.com/ticket/564)
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ Paths::Paths(const CmdLineArgs& args)
|
|||||||
m_rdata = Path::Join(m_root, "data/");
|
m_rdata = Path::Join(m_root, "data/");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const wchar_t* subdirectoryName = args.Has("writableRoot")? 0 : L"0ad";
|
const char* subdirectoryName = args.Has("writableRoot")? 0 : "0ad";
|
||||||
|
|
||||||
// everything is a subdirectory of the root
|
// everything is a subdirectory of the root
|
||||||
if(!subdirectoryName)
|
if(!subdirectoryName)
|
||||||
@ -59,9 +59,9 @@ Paths::Paths(const CmdLineArgs& args)
|
|||||||
const char* envHome = getenv("HOME");
|
const char* envHome = getenv("HOME");
|
||||||
debug_assert(envHome);
|
debug_assert(envHome);
|
||||||
const NativePath home(wstring_from_utf8(envHome));
|
const NativePath home(wstring_from_utf8(envHome));
|
||||||
const NativePath xdgData = XDG_Path("XDG_DATA_HOME", home, Path::Join(home, ".local/share/"), subdirectoryName));
|
const NativePath xdgData = Path::Join(XDG_Path("XDG_DATA_HOME", home, Path::Join(home, ".local/share/")), subdirectoryName);
|
||||||
const NativePath xdgConfig = XDG_Path("XDG_CONFIG_HOME", home, Path::Join(home, ".config/"), subdirectoryName));
|
const NativePath xdgConfig = Path::Join(XDG_Path("XDG_CONFIG_HOME", home, Path::Join(home, ".config/")), subdirectoryName);
|
||||||
const NativePath xdgCache = XDG_Path("XDG_CACHE_HOME", home, Path::Join(home, ".cache/"), subdirectoryName));
|
const NativePath xdgCache = Path::Join(XDG_Path("XDG_CACHE_HOME", home, Path::Join(home, ".cache/")), subdirectoryName);
|
||||||
m_data = Path::AddSlash(xdgData);
|
m_data = Path::AddSlash(xdgData);
|
||||||
m_cache = Path::AddSlash(xdgCache);
|
m_cache = Path::AddSlash(xdgCache);
|
||||||
m_config = Path::AddSlash(Path::Join(xdgConfig, "config"));
|
m_config = Path::AddSlash(Path::Join(xdgConfig, "config"));
|
||||||
|
@ -278,7 +278,7 @@ JSBool GetBuildTimestamp(JSContext* cx, uintN argc, jsval* vp)
|
|||||||
void DumpHeap(const char* basename, int idx, JSContext* cx)
|
void DumpHeap(const char* basename, int idx, JSContext* cx)
|
||||||
{
|
{
|
||||||
char filename[64];
|
char filename[64];
|
||||||
sprintf_s(filename, ARRAY_SIZE(filename), "%hs.%03d.txt", basename, idx);
|
sprintf_s(filename, ARRAY_SIZE(filename), "%s.%03d.txt", basename, idx);
|
||||||
NativePath pathname = Path::Join(psLogDir(), filename);
|
NativePath pathname = Path::Join(psLogDir(), filename);
|
||||||
#if OS_WIN
|
#if OS_WIN
|
||||||
FILE* f = _wfopen(pathname.c_str(), L"w");
|
FILE* f = _wfopen(pathname.c_str(), L"w");
|
||||||
|
Loading…
Reference in New Issue
Block a user