Misiur
Misiur

Reputation: 5307

Electron only allow save to a folder

I need for my user to only be able to select a folder to be saved. Is it possible in electron to only allow folders to be selected via dialog#showSaveDialog? Filters only work on file extensions, there's no mention of filtering folders only.

Upvotes: 2

Views: 752

Answers (1)

spring
spring

Reputation: 18527

I use the showOpenDialog with the openDirectory flag for this.

Logically it doesn't make sense to "save" a folder since it is just a virtual "container". Allowing the user to select a folder to "open" in order to "save" data into it is the usual flow.

Upvotes: 2

Related Questions