Search code examples
node.jsnode-webkit

how to "save" a file/folder in the Node.js app "Universal GUI"


I can't figure out how to add a "save file/folder" input to Universal GUI.
I need to be able to pick a location to pass as a file or folder to the cli program without the file/folder in question existing already.
Selecting a pre-existing file to pass to the cli command is easy, just use the generic file upload entry.
And Universal GUI already has a "select folder" entry.
Both options require selecting one that already exists.
So all I need is to be able to select a file and/or folder that doesn't exist in a "save" form.
I've never found an alternative to NW.js that doesn't require manually setting up the Node.js launcher.
So that's what I run the app I made in/for Universal GUI.


Solution

  • The folder browser is designed to allow you to select existing folders or create new ones. File select will also allow you to create new files.

    browse for folder dialog

    It sounds like what you want is to use the folder selector, so the user can select the folder (or create it, then select it) as their output directory. Then give them an input text field to type a file name into. Then you just combine all of that together as an argument for the CLI.

    <cmd executable="myexe">
      <arg>--save "((outputDirectory))\((fileName)).txt"</arg>
    </cmd>
    <!--
      What would be sent to the command line:
      myexe --save "C:\Users\Bob\Desktop\SomeFolder\MyFile.txt"
    -->