How does "ask file with type" work?

Richard Gaskin ambassador at fourthworld.com
Fri Apr 6 10:49:16 EDT 2007


Earlier I'd written:

> Dave wrote:
>> Thanks a lot, the problem with adding the extension outside the  
>> choose file dialog is that if the file already exist it then bypasses  
>> the "Replace File" Dialog that is displayed inside the choose file  
>> dialog. e.g.
> 
> I believe this new form of "ask file" is designed to work as you 
> describe, but is currently broken:  in v2.8 build 360 it returns the 
> type of the file, and I could find no way to obtain the path.
> 
> I just BZ'd it:
> <http://quality.runrev.com/qacenter/show_bug.cgi?id=4612>

It seems I was too quick to take Dave's report at face value. Lead 
engineer Mark Waddingham looked into this less than 24 hours after I 
posted it, and let me know that the behavior of the "ask file" command 
appears to be fine.  Dave would have rec'd the same notice if only he 
would choose to log bug reports to the one place where they will get an 
engineer's attention.

If you supply a default name, the name portion preceding the file name 
extension is selected, preserving the file type extension.  That works well.

Also, any problem with the "ask file" command not returning the path 
appears to be limited to the Message Box, but works well in any other 
script.  Details are noted in that BZ report linked to above.

So this comes down to Dave's suggestion that the ask file command 
somehow force a file type extension when the user has deleted it from 
the prompt, and also provide its own notification of any conflicts with 
existing files.

OS X allows the developer to supply a file extension, and Rev provides a 
means for doing that.  But apparently the OS doesn't prevent the user 
from going out of their way to delete file type extensions in its 
dialog, and the "ask file" command (when used outside of the Message 
Box) faithfully returns exactly what the user entered.

Dave's concern was for the circumstance in which a user might delete the 
file extension in the prompt, and if the program chooses to then add a 
file type extension it may conflict with an existing file name and 
require prompting for the user.

Addressing that is, as Jacque pointed out, the responsibility of the 
developer, and there's nothing Rev nor OS X could do about that.

If a program elects to alter what a user has entered into that dialog, 
it is the responsibility of that program to check for conflicts and 
provide appropriate notification.

So while I did find a bug in the IDE's Message Box, Dave's problem is 
not Rev's.

-- 
  Richard Gaskin
  Fourth World Media Corporation
  ___________________________________________________________
  Ambassador at FourthWorld.com       http://www.FourthWorld.com



More information about the use-livecode mailing list