简体   繁体   中英

iup.getparam in Lua — prompting for a directory

I'm writing a Lua program that must prompt the user for a directory as one of a number of parameters for an operation (that involves copying a file to a target directory with a new name). Environment is Windows; I'm using Lua 5.1.

The relevant code currently looks like

require("iuplua")
local mediaFolder = "C:\some folder\some subfolder\"
local pPrompt = --this is a subset of the parameters
  "File name: %s\n"..
  "Destination: %f[DIR||"..mediaFolder.."]\n"

ret, strTargetFile, strTargetPath =
  iup.GetParam("Add Media from file ", param_action, pPrompt, "Initial file name", mediaFolder)

The resultant GUI looks like:

在此处输入图片说明

but when the selector button (...) is pressed, the initial directory shown is not C:\\some folder\\some subfolder\\ but whatever directory was last navigated to in the interface, and it isn't possible to select a directory, only a file.

I'm guessing I have a fundamental misunderstanding of how this should work? Is what I want to do possible with iup? Ideally, I'd also like to restrict the user to only selecting the initial directory or one of its sub-directories rather than navigating anywhere outside that directory structure, and to allow the user to create a new sub-folder.

This looks like a bug. I'll check it.

Don't know if Stack Overflow is a place for bug reports, but I monitor iup posts here.

Best

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM