diff --git a/packages/app-mobile/root.tsx b/packages/app-mobile/root.tsx index a46518726b..cb5c1c93ae 100644 --- a/packages/app-mobile/root.tsx +++ b/packages/app-mobile/root.tsx @@ -116,7 +116,7 @@ import ProfileSwitcher from './components/ProfileSwitcher/ProfileSwitcher'; import ProfileEditor from './components/ProfileSwitcher/ProfileEditor'; import sensorInfo, { SensorInfo } from './components/biometrics/sensorInfo'; import { getCurrentProfile } from '@joplin/lib/services/profileConfig'; -import { getDatabaseName, getProfilesRootDir, getResourceDir, setDispatch } from './services/profiles'; +import { getDatabaseName, getPluginDataDir, getProfilesRootDir, getResourceDir, setDispatch } from './services/profiles'; import userFetcher, { initializeUserFetcher } from '@joplin/lib/utils/userFetcher'; import { ReactNode } from 'react'; import { parseShareCache } from '@joplin/lib/services/share/reducer'; @@ -495,6 +495,7 @@ async function initialize(dispatch: Function) { const resourceDir = getResourceDir(currentProfile, isSubProfile); Setting.setConstant('resourceDir', resourceDir); Setting.setConstant('pluginDir', `${getProfilesRootDir()}/plugins`); + Setting.setConstant('pluginDataDir', getPluginDataDir(currentProfile, isSubProfile)); await shim.fsDriver().mkdir(resourceDir); diff --git a/packages/app-mobile/services/profiles/index.ts b/packages/app-mobile/services/profiles/index.ts index 3d7cd059f4..04a0c1b9aa 100644 --- a/packages/app-mobile/services/profiles/index.ts +++ b/packages/app-mobile/services/profiles/index.ts @@ -26,6 +26,11 @@ export const getResourceDir = (profile: Profile, isSubProfile: boolean) => { return `${getProfilesRootDir()}/resources-${profile.id}`; }; +export const getPluginDataDir = (profile: Profile, isSubProfile: boolean) => { + const suffix = isSubProfile ? `-${profile.id}` : ''; + return `${getProfilesRootDir()}/plugin-data${suffix}`; +}; + // The suffix is for debugging only export const getDatabaseName = (profile: Profile, isSubProfile: boolean, suffix = '') => { if (!isSubProfile) return `joplin${suffix}.sqlite`;