mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 22:22:54 +02:00
Merge pull request #13253 from Atlante45/fix/sandbox-logs
Move Sandbox logs to AppDataLocal
This commit is contained in:
commit
7509e4237f
1 changed files with 22 additions and 6 deletions
|
@ -75,10 +75,14 @@ function getBuildInfo() {
|
||||||
}
|
}
|
||||||
const buildInfo = getBuildInfo();
|
const buildInfo = getBuildInfo();
|
||||||
|
|
||||||
function getRootHifiDataDirectory() {
|
function getRootHifiDataDirectory(local) {
|
||||||
var organization = buildInfo.organization;
|
var organization = buildInfo.organization;
|
||||||
if (osType == 'Windows_NT') {
|
if (osType == 'Windows_NT') {
|
||||||
|
if (local) {
|
||||||
|
return path.resolve(osHomeDir(), 'AppData/Local', organization);
|
||||||
|
} else {
|
||||||
return path.resolve(osHomeDir(), 'AppData/Roaming', organization);
|
return path.resolve(osHomeDir(), 'AppData/Roaming', organization);
|
||||||
|
}
|
||||||
} else if (osType == 'Darwin') {
|
} else if (osType == 'Darwin') {
|
||||||
return path.resolve(osHomeDir(), 'Library/Application Support', organization);
|
return path.resolve(osHomeDir(), 'Library/Application Support', organization);
|
||||||
} else {
|
} else {
|
||||||
|
@ -94,8 +98,8 @@ function getAssignmentClientResourcesDirectory() {
|
||||||
return path.join(getRootHifiDataDirectory(), '/assignment-client');
|
return path.join(getRootHifiDataDirectory(), '/assignment-client');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getApplicationDataDirectory() {
|
function getApplicationDataDirectory(local) {
|
||||||
return path.join(getRootHifiDataDirectory(), '/Server Console');
|
return path.join(getRootHifiDataDirectory(local), '/Server Console');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update lock filepath
|
// Update lock filepath
|
||||||
|
@ -104,7 +108,7 @@ const UPDATER_LOCK_FULL_PATH = getRootHifiDataDirectory() + "/" + UPDATER_LOCK_F
|
||||||
|
|
||||||
// Configure log
|
// Configure log
|
||||||
global.log = require('electron-log');
|
global.log = require('electron-log');
|
||||||
const logFile = getApplicationDataDirectory() + '/log.txt';
|
const logFile = getApplicationDataDirectory(true) + '/log.txt';
|
||||||
fs.ensureFileSync(logFile); // Ensure file exists
|
fs.ensureFileSync(logFile); // Ensure file exists
|
||||||
log.transports.file.maxSize = 5 * 1024 * 1024;
|
log.transports.file.maxSize = 5 * 1024 * 1024;
|
||||||
log.transports.file.file = logFile;
|
log.transports.file.file = logFile;
|
||||||
|
@ -221,7 +225,19 @@ function deleteOldFiles(directoryPath, maxAgeInSeconds, filenameRegex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var logPath = path.join(getApplicationDataDirectory(), '/logs');
|
var oldLogPath = path.join(getApplicationDataDirectory(), '/logs');
|
||||||
|
var logPath = path.join(getApplicationDataDirectory(true), '/logs');
|
||||||
|
|
||||||
|
if (oldLogPath != logPath) {
|
||||||
|
console.log("Migrating old logs from " + oldLogPath + " to " + logPath);
|
||||||
|
fs.copy(oldLogPath, logPath, err => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
|
} else {
|
||||||
|
console.log('success!');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
log.debug("Log directory:", logPath);
|
log.debug("Log directory:", logPath);
|
||||||
log.debug("Data directory:", getRootHifiDataDirectory());
|
log.debug("Data directory:", getRootHifiDataDirectory());
|
||||||
|
|
Loading…
Reference in a new issue