Changeset View
Changeset View
Standalone View
Standalone View
source/ps/CacheLoader.cpp
Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | VfsPath CCacheLoader::LooseCachePath(const VfsPath& sourcePath, const MD5& initialHash, u32 version) | ||||
hash.Update((const u8*)&version, sizeof(version)); | hash.Update((const u8*)&version, sizeof(version)); | ||||
// these are local cached files, so we don't care about endianness etc | // these are local cached files, so we don't care about endianness etc | ||||
u8 digest[MD5::DIGESTSIZE]; | u8 digest[MD5::DIGESTSIZE]; | ||||
hash.Final(digest); | hash.Final(digest); | ||||
// Get the mod path | // Get the mod path | ||||
OsPath path; | OsPath path; | ||||
m_VFS->GetRealPath(sourcePath, path); | m_VFS->GetOriginalPath(sourcePath, path); | ||||
return VfsPath("cache") / | return VfsPath("cache") / | ||||
path_name_only(path.BeforeCommon(sourcePath).Parent().string().c_str()) / | path_name_only(path.BeforeCommon(sourcePath).Parent().string().c_str()) / | ||||
sourcePath.ChangeExtension(sourcePath.Extension().string() + | sourcePath.ChangeExtension(sourcePath.Extension().string() + | ||||
L"." + | L"." + | ||||
// Use a short prefix of the full hash (we don't need high collision-resistance) | // Use a short prefix of the full hash (we don't need high collision-resistance) | ||||
wstring_from_utf8(Hexify(digest, 8)) + | wstring_from_utf8(Hexify(digest, 8)) + | ||||
m_FileExtension); | m_FileExtension); | ||||
} | } |
Wildfire Games · Phabricator