1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Various tweaks to build portable version

This commit is contained in:
Laurent Cozic
2018-05-14 11:08:33 +01:00
parent 23c592b322
commit 359b8d5545
5 changed files with 28 additions and 12 deletions

View File

@ -377,6 +377,14 @@ class BaseApplication {
return flags.matched;
}
determineProfileDir(initArgs) {
if (initArgs.profileDir) return initArgs.profileDir;
if (process && process.env && process.env.PORTABLE_EXECUTABLE_DIR) return process.env.PORTABLE_EXECUTABLE_DIR + '/JoplinProfile';
return os.homedir() + '/.config/' + Setting.value('appName');
}
async start(argv) {
let startFlags = await this.handleStartFlags_(argv);
@ -384,17 +392,11 @@ class BaseApplication {
let initArgs = startFlags.matched;
if (argv.length) this.showPromptString_ = false;
// if (process.argv[1].indexOf('joplindev') >= 0) {
// if (!initArgs.profileDir) initArgs.profileDir = '/mnt/d/Temp/TestNotes2';
// initArgs.logLevel = Logger.LEVEL_DEBUG;
// initArgs.env = 'dev';
// }
let appName = initArgs.env == 'dev' ? 'joplindev' : 'joplin';
if (Setting.value('appId').indexOf('-desktop') >= 0) appName += '-desktop';
Setting.setConstant('appName', appName);
const profileDir = initArgs.profileDir ? initArgs.profileDir : os.homedir() + '/.config/' + Setting.value('appName');
const profileDir = this.determineProfileDir(initArgs);
const resourceDir = profileDir + '/resources';
const tempDir = profileDir + '/tmp';