mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-24 08:12:24 +02:00
Mobile: Plugin API: Fix error when calling plugins.dataDir
(#10262)
This commit is contained in:
parent
500c8facdb
commit
384b17738a
@ -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);
|
||||
|
||||
|
@ -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`;
|
||||
|
Loading…
Reference in New Issue
Block a user