How to supply default directory path to window.promptOpenDirectory()

Started by jp77, September 16, 2021, 17:55:09 PM

Previous topic - Next topic

jp77

Hi

I'm trying to supply a default folder path to window.promptOpenDirectory() function, but getting a runtime syntax error ("Expected : but found }") when using as described in the reference:

var dirPath = window.promptOpenDirectory({ title: "Open Folder", "/defaultPath" });

The reference shows a different syntax for other WindowPrompt functions e.g. window.promptOpenFile({ property: value, property: value });

Is the documented syntax correct for window.promptOpenDirectory() or is there something else I'm missing?

When following this other syntax it runs fine but the default path isn't set (stays in default Archi directory) e.g.
var dirPath = window.promptOpenDirectory({ title: "Open Folder",  defaultPath: "/defaultPath" });

Is there a property that can be set for default path?

Thanks in advance
John

Jean-Baptiste Sarrodie

Hi,

You have to use the keyword "filterPath" (borrowed from internal eclipse framework):

var dirPath = window.promptOpenDirectory({ title: "Open Folder",  filterPath: "/tmp" });


I'm fixing the wiki page. Thank you for reporting this doc issue.

Regards,

JB
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.