[plt-scheme] "Create Executable" chooses bad default executable name

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Jan 23 16:26:23 EST 2007

At Tue, 23 Jan 2007 08:58:31 -0700, Evan Farrer wrote:
> There seems to be a design issue with the "Create Executable" dialog box.  If 
> I create a module in a file called 'hello.scm' and then open the "Create 
> Executable" dialog box the default name for the executable is 'hello.scm' 
> which if accepted will clober the source.

This has been bugging me, too.

>  There appears to be a function in 
> collects/drscheme/private/unit.ss called 'basename' that was inteded to be 
> used to fix this issue, but it doesn't appear to be called from anywhere (and 
> it appeared to be broken) the attached patch.  Fixes up the basename function 
> and calls it when initializing the "Create Executable" dialog box so I don't 
> have to worry about clobbering my source ;)

I think the `create-executable' method, which is where you made the
change, needs the original pathname with the suffix intact.

The problem is instead in the "Create Executable" dialog, which was
leaving the suffix alone if the executable format doesn't normally use
a suffix. I changed it to remove any suffix on the filename in that
case.

FWIW, a simpler implementation of `basename' is

 (define (basename p)
   (path-replace-suffix p #""))

but I removed the unused `basename' function.

Thanks!
Matthew



Posted on the users mailing list.