mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 22:22:54 +02:00
Merge pull request #10693 from seefo/master
Incomplete sandbox content updates are now removed and reperformed
This commit is contained in:
commit
c807827a36
1 changed files with 24 additions and 1 deletions
|
@ -101,6 +101,10 @@ function getApplicationDataDirectory() {
|
||||||
return path.join(getRootHifiDataDirectory(), '/Server Console');
|
return path.join(getRootHifiDataDirectory(), '/Server Console');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update lock filepath
|
||||||
|
const UPDATER_LOCK_FILENAME = ".updating";
|
||||||
|
const UPDATER_LOCK_FULL_PATH = getRootHifiDataDirectory() + "/" + UPDATER_LOCK_FILENAME;
|
||||||
|
|
||||||
// Configure log
|
// Configure log
|
||||||
global.log = require('electron-log');
|
global.log = require('electron-log');
|
||||||
const logFile = getApplicationDataDirectory() + '/log.txt';
|
const logFile = getApplicationDataDirectory() + '/log.txt';
|
||||||
|
@ -630,11 +634,22 @@ function checkNewContent() {
|
||||||
userConfig.save(configPath);
|
userConfig.save(configPath);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if (fs.existsSync(UPDATER_LOCK_FULL_PATH)) {
|
||||||
|
backupResourceDirectoriesAndRestart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeIncompleteUpdate(acResourceDirectory, dsResourceDirectory) {
|
||||||
|
if (fs.existsSync(UPDATER_LOCK_FULL_PATH)) {
|
||||||
|
log.debug('Removing incomplete content update files before copying new update');
|
||||||
|
fs.emptyDirSync(dsResourceDirectory);
|
||||||
|
fs.emptyDirSync(acResourceDirectory);
|
||||||
|
} else {
|
||||||
|
fs.ensureFileSync(UPDATER_LOCK_FULL_PATH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function maybeInstallDefaultContentSet(onComplete) {
|
function maybeInstallDefaultContentSet(onComplete) {
|
||||||
// Check for existing data
|
// Check for existing data
|
||||||
|
@ -673,7 +688,11 @@ function maybeInstallDefaultContentSet(onComplete) {
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug("Found contentPath:" + argv.contentPath);
|
log.debug("Found contentPath:" + argv.contentPath);
|
||||||
|
|
||||||
if (argv.contentPath) {
|
if (argv.contentPath) {
|
||||||
|
// check if we're updating a data folder whose update is incomplete
|
||||||
|
removeIncompleteUpdate(acResourceDirectory, dsResourceDirectory);
|
||||||
|
|
||||||
fs.copy(argv.contentPath, getRootHifiDataDirectory(), function (err) {
|
fs.copy(argv.contentPath, getRootHifiDataDirectory(), function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
log.debug('Could not copy home content: ' + err);
|
log.debug('Could not copy home content: ' + err);
|
||||||
|
@ -682,12 +701,12 @@ function maybeInstallDefaultContentSet(onComplete) {
|
||||||
log.debug('Copied home content over to: ' + getRootHifiDataDirectory());
|
log.debug('Copied home content over to: ' + getRootHifiDataDirectory());
|
||||||
userConfig.set('homeContentLastModified', new Date());
|
userConfig.set('homeContentLastModified', new Date());
|
||||||
userConfig.save(configPath);
|
userConfig.save(configPath);
|
||||||
|
fs.removeSync(UPDATER_LOCK_FULL_PATH);
|
||||||
onComplete();
|
onComplete();
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Show popup
|
// Show popup
|
||||||
var window = new BrowserWindow({
|
var window = new BrowserWindow({
|
||||||
icon: appIcon,
|
icon: appIcon,
|
||||||
|
@ -718,6 +737,9 @@ function maybeInstallDefaultContentSet(onComplete) {
|
||||||
|
|
||||||
var aborted = false;
|
var aborted = false;
|
||||||
|
|
||||||
|
// check if we're updating a data folder whose update is incomplete
|
||||||
|
removeIncompleteUpdate(acResourceDirectory, dsResourceDirectory);
|
||||||
|
|
||||||
// Start downloading content set
|
// Start downloading content set
|
||||||
var req = progress(request.get({
|
var req = progress(request.get({
|
||||||
url: HOME_CONTENT_URL
|
url: HOME_CONTENT_URL
|
||||||
|
@ -763,6 +785,7 @@ function maybeInstallDefaultContentSet(onComplete) {
|
||||||
log.debug("Finished unarchiving home content set");
|
log.debug("Finished unarchiving home content set");
|
||||||
userConfig.set('homeContentLastModified', new Date());
|
userConfig.set('homeContentLastModified', new Date());
|
||||||
userConfig.save(configPath);
|
userConfig.save(configPath);
|
||||||
|
fs.removeSync(UPDATER_LOCK_FULL_PATH);
|
||||||
sendStateUpdate('complete');
|
sendStateUpdate('complete');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue