mirror of
https://github.com/OpenFusionProject/Client.git
synced 2024-11-14 02:30:05 +00:00
Merge pull request #8 from gsemaj/caching
Implement basic rename-based cache switching
This commit is contained in:
commit
54f083c22d
@ -95,7 +95,37 @@ function loadServerList() {
|
||||
function setGameInfo(serverUUID) {
|
||||
var result = serverarray.filter(function(obj) {return (obj.uuid === serverUUID);})[0];
|
||||
var gameversion = versionarray.filter(function(obj) {return (obj.name === result.version);})[0];
|
||||
window.asseturl = gameversion.url // gameclient.js needs to access this
|
||||
|
||||
// Cache folder renaming
|
||||
var cachedir = userdir + '\\..\\..\\LocalLow\\Unity\\Web Player\\Cache';
|
||||
var curversion = cachedir + '\\Fusionfall';
|
||||
var newversion = cachedir + '\\' + gameversion.name;
|
||||
var record = userdir + '\\.lastver';
|
||||
|
||||
if (remotefs.existsSync(curversion)) {
|
||||
// cache already exists
|
||||
// find out what version it belongs to
|
||||
if (remotefs.existsSync(record)) {
|
||||
var lastversion = remotefs.readFileSync(record);
|
||||
remotefs.renameSync(curversion, cachedir + '\\' + lastversion);
|
||||
console.log('Cached version ' + lastversion);
|
||||
} else {
|
||||
console.log(
|
||||
"Couldn't find last version record; cache may get overwritten"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (remotefs.existsSync(newversion)) {
|
||||
// rename saved cache to FusionFall
|
||||
remotefs.renameSync(newversion, curversion);
|
||||
console.log('Loaded cached ' + gameversion.name);
|
||||
}
|
||||
|
||||
// make note of what version we are launching for next launch
|
||||
remotefs.writeFileSync(record, gameversion.name);
|
||||
|
||||
window.asseturl = gameversion.url; // gameclient.js needs to access this
|
||||
|
||||
remotefs.writeFileSync(__dirname+"\\assetInfo.php", asseturl);
|
||||
remotefs.writeFileSync(__dirname+"\\loginInfo.php", result.ip);
|
||||
|
Loading…
Reference in New Issue
Block a user