ID:2126842
 
Applies to:
Status: Open

Issue hasn't been assigned a status value.
I couldn't find a previous post like this so I decided to post it.

When using the file type or ftp() proc, can we specify the file extension we want to use?

For example we would normally do this to select a file:
mob
verb
ImportFile(var/ImportedFile as file)


But instead we could do something like this:
dmfile
parent_type = /file
extension = ".dm"

mob
verb
ImportFile(var/ImportedFile as dmfile)


I have no idea how it would actually work but the above is just an example to get the point through.

Also for the ftp proc we could have another argument:
mob
verb
ExportFile()
src << ftp(file, name, extension)


Thanks
What about something like this:

mob/verb/import(f as file as in list(".dm", ".extension2"))
For ftp(), the extension would be part of the name already. I'm not sure I understand the point of the third argument.
@Lummox

Your right about that, I must have missed that.

@FKI

That is much better! But have "as in" would seem like it could cause an issue somewhere (I don't know, it just seems like it will).

How about a with (I don't think that has been used in DM)

mob
verb
ImportFile(var/ImportedFile as file with list(".dm", ".extension2"))


I don't really know what I am saying now... Anything would be fine actually.
Lummox, the thing is for grabbing files from a user, we might want to specify the extension filter in the open dialog box, as well as the extension filter in the save dialog box if the file could be saved as multiple extensions to make it easier for a user to select a file to override with.


On that note, if those could have better default directories, as right now the start dir the user has is always their temp folder when those open/save dialog boxes open. maybe default to one, with some way to specify other common directories, (but not specify any random directory, as that could be abused some way) like a define, DIRECTORY_HOME, DIRECTORY_PICTURES, DIRECTORY_BYOND_CACHE, DIRECTORY_DOWNLOADS etc