Archi Forum

Archi Plug-ins => jArchi => Topic started by: jp77 on September 16, 2021, 16:55:09 PM

Title: How to supply default directory path to window.promptOpenDirectory()
Post by: jp77 on September 16, 2021, 16:55:09 PM
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
Title: Re: How to supply default directory path to window.promptOpenDirectory()
Post by: Jean-Baptiste Sarrodie on September 16, 2021, 18:33:42 PM
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
Title: Re: How to supply default directory path to window.promptOpenDirectory()
Post by: jp77 on September 17, 2021, 09:23:21 AM
That's great thanks for the update  :)