I'm working on a FileMaker 18 solution. One of the things I have to solve is executing an external Python script and reading its results back. That script can run for some seconds. Since my solution should work cross-platform (I develop on MacOS, but most users will be on Windows), I settled on the Basic Elements plugin to do the script execution.
Since this is a custom script that we'll deliver together with the solution, FileMaker needs to know in which directory it is located (and also to import the resulting XML). To my surprise, BE_ExecuteSystemCommand defaults to the root directory, not to the directory the solution is installed in.
What is the best practice to get and store a data or other directory that could be user and/or system specific?
My current thought was to create a simple "globals" key/value pair table to store paths and such, and write a script that on launch checks if a value with a key of "datapath" is set, if yes, store it in a global variable other scripts can reference. If not, prompt the user with a file open dialog to select that directory. He would only have to do that once, when launching the solution the first time.
Before doing all that myself, I'm asking here if there is a best practice on how to do that, specifically, or if I'm thinking wrong and should be doing it in some other way?
I will likely be needing the data directory for a few other purposes (data import, etc.) as well.
Filemaker has native functions that return some common paths:
Get(FileMakerPath) - path to the FileMaker application running the current file;
Get(FilePath) - path to the current file;
Get(DocumentsPath) - path to the Documents folder of the current user;
Get(DesktopPath) - path to the desktop folder of the current user;
Get(PreferencesPath) - path to the preferences folder of the current user.
Get(TemporaryPath) - path to the temporary folder of the current user;
Note that the paths returned by these functions are Filemaker paths, not OS paths.