Question regarding `joplin.plugins.installationDir` path in Joplin's production environment

Hi everyone, I have a quick question. Does joplin.plugins.installationDir leads to the plugin's dist folder in Joplin's production environment?

When I call the API, I get this path: /Users/billtonhoang/Documents/GitHub/joplin-hahabill/plugin-ai-summarisation/dist

To give context, I am using the Webpack's CopyPlugin to copy the word2vec library to dist since it uses the child process to execute a script from Google Research. In my plugin, I would just tell the library to point to the path where the scripts are to do

Example

// SRC_FOLDER would be joplin.plugins.installationDir + /word2vec/src
var word2vecProc = spawn( './word2vec', ['-train', input, '-output', output ].concat(paramsArr), { cwd: SRC_FOLDER } );
	word2vecProc.stdout.on( 'data', function onData( data ) {
		if ( !silent ) {
			charm.foreground( 'cyan' );
			charm.write( data );
		}
	});

In production I think this points to the .../joplin-desktop/cache/name.of.plugin dir which should contain the same data as your dist dir. I could be wrong, it has been a while since I messed with it. This should be the location for files used for running the plugin as they get cleared on restart.

1 Like

joplin.plugins.dataDir() = Persistent (For storing plugin data) and is located under ~\.config\joplin-desktop\plugin-data\<PLUGINID>

joplin.plugins.installationDir() = Temporary (Plugin jpl is unpacked here at Joplin runtime) and is located under ~\.config\joplin-desktop\cache\<PLUGINID>

2 Likes

Thank you guys for the answers! Those are really helpful!

1 Like