How to create a File dialog?


How to open a native File dialog from a package?

It seems that require "dialog" does not work.


I would also like to open a File dialog. My goal is to to save as the contents of a view when a user attempts to save.

My Package:


@leedohm hey, is there a way to do it?


I cannot be sure, but I think you could potentially use the following:

Note though that the above will present the File/Folder Dialog and open the selection in a New Window.

To get a Save As dialog, I believe it should be possible to use:


I haven’t tried the above out myself, but from the source these seem to be the most probable candidates for what you want.

If none of the above work, then you might have to dig deeper in to the “remote”, “ipc”, & “dialog” modules.

Hope that helps!


Thanks a lot! :thumbsup: or atom.showSaveDialogSync() does not return the path.

After I dig in a little more, here is what I come up:

remote = require "remote"
dialog = remote.require "dialog"


APIs: dialog and remote


Sorry @zhuochun, I don’t know of a way … but I also haven’t looked into it. It sounds like the other suggestions here are good, though :grinning: