ID:1048731
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
There's currently no way to have the user choose a directory as input (essentially returning a file path in text format). I am requesting that it is possible to have directory be available as an input type returning a text string containing the path to the directory chosen by the user.

mob/verb/batch()
var/folder = input("What folder would you like to work in?", "Choose Folder") as null | directory
if(!folder)
return
alert("The path you chose is [folder]")


To be clear, this would not be to allow cross network file system browsing. It is intended for local file system only.
Couldn't you not just use the 'flist' process to access your directories? I do that.
MasterSpectra, he doesn't wants people to choose a directory on their pc, which can be anything to choose that directory...

Anyways, just want to ask what your use case is FIREking?

Anyways, this should be simple enough, there is a FilePickerDialog & FolderPickerDialog as part of windows & C++, i'm sure VB6 even had one of these controls & such, it should be easy enough to use that control to have people pick a whole directory instead.
In response to Superbike32
There are some complications to consider, however. First off, it's only really useful to select a directory on the host's computer, as that's the only file system the game can access. So that means it's selecting a directory over a network.

Second, it would have to be limited to whatever security settings the host has (ultrasafe, safe, or trusted--is it limited to the game's directory only, or can it browse the entire system?).

Also, there are security/privacy concerns with displaying a file path. I'm not aware of a way to get the absolute path currently without a dll, so the staff may agree with said concern.

Overall, I think flist() is the way to go. Unless there's some super awesome use for this that I can't think of, it would probably be more hassle than it's worth.
If I want to write a utility for batch icon procedures, I have no way of asking what folder to work in.
In response to DarkCampainger
Well the use case is the people select a directory thus voluntarily would give access.

Anyways file dialogs work for anyone, if you use a send file system in a game, it allows the dialog for anyone on the game to get the dialog & select a file, access to the filesystem directly(by typed name though) is however restricted to the host pc & by security level, anything not selected by a user is ultimately fully restricted over a network.

However in this case, the use case is the host only as I see it.

Anyways he could flist() a directory someone selected a file in possibly in trusted mode, and flist() in safe mode would work for files in the same directory or a sub-directory of the game itself....

---Anyways for a personal utility or not so often used utility, I would include a set folder to drag the files to do the operation on, and use flist(), the folder would be in a sub-directory of the utility, such as saves are usually in a sub-directory named saves/player saves, or what not.

Considering all of BYOND's security concerns & everything, I don't think allowing enumeration of whole directories at a time is a good idea, not to mention what to do if there are sub-directories of that directory.

---This is because people should have fine control about what their allowing to be accessed, even if whatever is accessing it would not be malicious, because potentially people can even write malicious or highly annoying things in BYOND, and some people if such a utility was released claiming to do one thing, could ultimately do another and the one wanting to use it, just not read over the code to see, or if it doesn't include the code & just host files.
This would be no different than input() as file except it would use the default dialog for choosing folders in windows. It just returns a string. Its not dangerous.
FIREking, in itself it isn't dangerous but choosing whole directories, and possible access to sub-directories & it's files too, or the ability to read all the files in said path & do whatever you want with them is potentially dangerous, if they want a set of files located on C: for example, then it would be able to read every file on your drive, or possibly depending on how it works every file just in that subfolder that is outside the scope of the files needing converted...

Since BYOND does use the net, it could potentially be used maliciously depending on whats allowed & the scope of it & send out information on your files that you didn't want to convert or a whole set of files at once that you did want to convert to be stolen by another.

---I am not saying allow it, but when the scope changes from a single file to whole directory of files, there needs to be some sort of security to only allow access to wanted files.

Even a mass selection of files, in the same directory, like control+click, or drag & select the files you want is better than all out letting it read directories of your pc or without strict rules, such as only files in that directory, of a certain type, no sub-folder access, in fact subfolders aren't enumerated at all.

---I am just saying security needs to be taken into consideration so it couldn't be used potentially to delete files that you never wanted to be accessed or potentially send a whole group of files away, where-as selecting a single file, only that file is at risk in any way since no other files are known about or accessible.
In response to Superbike32
Superbike32 wrote:
FIREking, in itself it isn't dangerous but choosing whole directories, and possible access to sub-directories & it's files too, or the ability to read all the files in said path & do whatever you want with them is potentially dangerous, if they want a set of files located on C: for example, then it would be able to read every file on your drive, or possibly depending on how it works every file just in that subfolder that is outside the scope of the files needing converted...

Since BYOND does use the net, it could potentially be used maliciously depending on whats allowed & the scope of it & send out information on your files that you didn't want to convert or a whole set of files at once that you did want to convert to be stolen by another.

---I am not saying allow it, but when the scope changes from a single file to whole directory of files, there needs to be some sort of security to only allow access to wanted files.

Even a mass selection of files, in the same directory, like control+click, or drag & select the files you want is better than all out letting it read directories of your pc or without strict rules, such as only files in that directory, of a certain type, no sub-folder access, in fact subfolders aren't enumerated at all.

---I am just saying security needs to be taken into consideration so it couldn't be used potentially to delete files that you never wanted to be accessed or potentially send a whole group of files away, where-as selecting a single file, only that file is at risk in any way since no other files are known about or accessible.

This is why byond has a ultra safe, safe, and trusted modes.
In response to Superbike32
Actually, I'll probably just use javascript or something.
OK I understand BYOND's modes but I am talking about allow actions but only allowing it to read the needed files, no more info than that, since there can be more in that directory, or sub-directories you don't want read...

Ultra Safe, Safe, Trusted can help block it completely or bring up annoying dialogs to ask every time, but BYOND has no sense of a GUI, they just popup lots of annoying, stale dialogs, and they popup a lot of them, with no sense of combining things into one dialog, to see everything, and allow actions quicker without going through 100 dialogs.

If the prompts can up in one window, saying like, blocked access to 100 files, listed below, you can block, allow certain files, file types, whatever, allow all, block all, and that's it...no more messing around.
In response to FIREking
JavaScript won't give you the file path either, for the same security/privacy reasons (at least, not in any recent browser versions). Neither will Flash. Currently, if you want the host to be able to select a folder outside of the project directory and then run an operation on all files in the folder, you have to write a DLL.

I don't see this feature being feasible for the reasons I previously mentioned (but I'm not staff).
I guess I took this for granted in Window application development.