You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	This commit is contained in:
		| @@ -685,7 +685,7 @@ packages/lib/components/shared/side-menu-shared.js | ||||
| packages/lib/database-driver-better-sqlite.js | ||||
| packages/lib/database.js | ||||
| packages/lib/debug/DebugService.js | ||||
| packages/lib/determineProfileDir.js | ||||
| packages/lib/determineBaseAppDirs.js | ||||
| packages/lib/dom.js | ||||
| packages/lib/errorUtils.js | ||||
| packages/lib/errors.js | ||||
|   | ||||
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -665,7 +665,7 @@ packages/lib/components/shared/side-menu-shared.js | ||||
| packages/lib/database-driver-better-sqlite.js | ||||
| packages/lib/database.js | ||||
| packages/lib/debug/DebugService.js | ||||
| packages/lib/determineProfileDir.js | ||||
| packages/lib/determineBaseAppDirs.js | ||||
| packages/lib/dom.js | ||||
| packages/lib/errorUtils.js | ||||
| packages/lib/errors.js | ||||
|   | ||||
| @@ -10,7 +10,7 @@ const FsDriverNode = require('@joplin/lib/fs-driver-node').default; | ||||
| const envFromArgs = require('@joplin/lib/envFromArgs'); | ||||
| const packageInfo = require('./packageInfo.js'); | ||||
| const { isCallbackUrl } = require('@joplin/lib/callbackUrlUtils'); | ||||
| const determineProfileDir = require('@joplin/lib/determineProfileDir').default; | ||||
| const determineBaseAppDirs = require('@joplin/lib/determineBaseAppDirs').default; | ||||
|  | ||||
| // Electron takes the application name from package.json `name` and | ||||
| // displays this in the tray icon toolip and message box titles, however in | ||||
| @@ -45,7 +45,7 @@ const isDebugMode = !!process.argv && process.argv.indexOf('--debug') >= 0; | ||||
| const appId = `net.cozic.joplin${env === 'dev' ? 'dev' : ''}-desktop`; | ||||
| let appName = env === 'dev' ? 'joplindev' : 'joplin'; | ||||
| if (appId.indexOf('-desktop') >= 0) appName += '-desktop'; | ||||
| const rootProfileDir = determineProfileDir(profileFromArgs, appName); | ||||
| const { rootProfileDir } = determineBaseAppDirs(profileFromArgs, appName); | ||||
| const settingsPath = `${rootProfileDir}/settings.json`; | ||||
| let autoUploadCrashDumps = false; | ||||
|  | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import { safeModeFlagFilename } from '@joplin/lib/BaseApplication'; | ||||
| import initProfile from '@joplin/lib/services/profileConfig/initProfile'; | ||||
| import { writeFile } from 'fs-extra'; | ||||
| import { join } from 'path'; | ||||
| import determineProfileDir from '@joplin/lib/determineProfileDir'; | ||||
| import determineBaseAppDirs from '@joplin/lib/determineBaseAppDirs'; | ||||
|  | ||||
|  | ||||
| const restartInSafeModeFromMain = async () => { | ||||
| @@ -21,7 +21,7 @@ const restartInSafeModeFromMain = async () => { | ||||
| 	shimInit({}); | ||||
|  | ||||
| 	const startFlags = await processStartFlags(bridge().processArgv()); | ||||
| 	const rootProfileDir = determineProfileDir(startFlags.matched.profileDir, appName); | ||||
| 	const { rootProfileDir } = determineBaseAppDirs(startFlags.matched.profileDir, appName); | ||||
| 	const { profileDir } = await initProfile(rootProfileDir); | ||||
|  | ||||
| 	// We can't access the database, so write to a file instead. | ||||
|   | ||||
| @@ -2,6 +2,6 @@ | ||||
| 	"io.github.jackgruber.backup": { | ||||
| 		"cloneUrl": "https://github.com/JackGruber/joplin-plugin-backup.git", | ||||
| 		"branch": "master", | ||||
| 		"commit": "bd49c665bf60c1e0dd9b9862b2ba69cad3d4c9ae" | ||||
| 		"commit": "2d814a5466604daced108331d14aedf8e8414d62" | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -61,7 +61,7 @@ import RotatingLogs from './RotatingLogs'; | ||||
| import { NoteEntity } from './services/database/types'; | ||||
| import { join } from 'path'; | ||||
| import processStartFlags from './utils/processStartFlags'; | ||||
| import determineProfileDir from './determineProfileDir'; | ||||
| import determineProfileAndBaseDir from './determineBaseAppDirs'; | ||||
|  | ||||
| const appLogger: LoggerWrapper = Logger.create('App'); | ||||
|  | ||||
| @@ -639,7 +639,7 @@ export default class BaseApplication { | ||||
| 		// https://immerjs.github.io/immer/docs/freezing | ||||
| 		setAutoFreeze(initArgs.env === 'dev'); | ||||
|  | ||||
| 		const rootProfileDir = options.rootProfileDir ? options.rootProfileDir : determineProfileDir(initArgs.profileDir, appName); | ||||
| 		const { rootProfileDir, homeDir } = determineProfileAndBaseDir(options.rootProfileDir ?? initArgs.profileDir, appName); | ||||
| 		const { profileDir, profileConfig, isSubProfile } = await initProfile(rootProfileDir); | ||||
| 		this.profileConfig_ = profileConfig; | ||||
|  | ||||
| @@ -655,6 +655,7 @@ export default class BaseApplication { | ||||
| 		Setting.setConstant('pluginDataDir', `${profileDir}/plugin-data`); | ||||
| 		Setting.setConstant('cacheDir', cacheDir); | ||||
| 		Setting.setConstant('pluginDir', `${rootProfileDir}/plugins`); | ||||
| 		Setting.setConstant('homeDir', homeDir); | ||||
|  | ||||
| 		SyncTargetRegistry.addClass(SyncTargetNone); | ||||
| 		SyncTargetRegistry.addClass(SyncTargetFilesystem); | ||||
|   | ||||
							
								
								
									
										23
									
								
								packages/lib/determineBaseAppDirs.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								packages/lib/determineBaseAppDirs.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| import { homedir } from 'os'; | ||||
| import { toSystemSlashes } from './path-utils'; | ||||
|  | ||||
| export default (profileFromArgs: string, appName: string) => { | ||||
| 	let profileDir = ''; | ||||
| 	let homeDir = ''; | ||||
|  | ||||
| 	if (profileFromArgs) { | ||||
| 		profileDir = profileFromArgs; | ||||
| 		homeDir = profileDir; | ||||
| 	} else if (process && process.env && process.env.PORTABLE_EXECUTABLE_DIR) { | ||||
| 		profileDir = `${process.env.PORTABLE_EXECUTABLE_DIR}/JoplinProfile`; | ||||
| 		homeDir = process.env.PORTABLE_EXECUTABLE_DIR; | ||||
| 	} else { | ||||
| 		profileDir = `${homedir()}/.config/${appName}`; | ||||
| 		homeDir = homedir(); | ||||
| 	} | ||||
|  | ||||
| 	return { | ||||
| 		rootProfileDir: toSystemSlashes(profileDir, 'linux'), | ||||
| 		homeDir: toSystemSlashes(homeDir, 'linux'), | ||||
| 	}; | ||||
| }; | ||||
| @@ -1,16 +0,0 @@ | ||||
| import { homedir } from 'os'; | ||||
| import { toSystemSlashes } from './path-utils'; | ||||
|  | ||||
| export default (profileFromArgs: string, appName: string) => { | ||||
| 	let output = ''; | ||||
|  | ||||
| 	if (profileFromArgs) { | ||||
| 		output = profileFromArgs; | ||||
| 	} else if (process && process.env && process.env.PORTABLE_EXECUTABLE_DIR) { | ||||
| 		output = `${process.env.PORTABLE_EXECUTABLE_DIR}/JoplinProfile`; | ||||
| 	} else { | ||||
| 		output = `${homedir()}/.config/${appName}`; | ||||
| 	} | ||||
|  | ||||
| 	return toSystemSlashes(output, 'linux'); | ||||
| }; | ||||
| @@ -146,6 +146,7 @@ export interface Constants { | ||||
| 	pluginDataDir: string; | ||||
| 	cacheDir: string; | ||||
| 	pluginDir: string; | ||||
| 	homeDir: string; | ||||
| 	flagOpenDevTools: boolean; | ||||
| 	syncVersion: number; | ||||
| 	startupDevPlugins: string[]; | ||||
| @@ -303,6 +304,7 @@ class Setting extends BaseModel { | ||||
| 		pluginDataDir: '', | ||||
| 		cacheDir: '', | ||||
| 		pluginDir: '', | ||||
| 		homeDir: '', | ||||
| 		flagOpenDevTools: false, | ||||
| 		syncVersion: 3, | ||||
| 		startupDevPlugins: [], | ||||
|   | ||||
| @@ -29,7 +29,7 @@ export interface Plugins { | ||||
| } | ||||
|  | ||||
| export interface SettingAndValue { | ||||
| 	[settingName: string]: string; | ||||
| 	[settingName: string]: string|number|boolean; | ||||
| } | ||||
|  | ||||
| export interface DefaultPluginSettings { | ||||
|   | ||||
| @@ -6,7 +6,8 @@ const getDefaultPluginsInfo = (): DefaultPluginsInfo => { | ||||
| 	const defaultPlugins = { | ||||
| 		'io.github.jackgruber.backup': { | ||||
| 			settings: { | ||||
| 				'path': `${Setting.value('profileDir')}`, | ||||
| 				'path': `${Setting.value('homeDir')}`, | ||||
| 				'createSubfolderPerProfile': true, | ||||
| 			}, | ||||
|  | ||||
| 			// Joplin Portable is more likely to run on a device with low write speeds | ||||
|   | ||||
		Reference in New Issue
	
	Block a user