www.digitalmars.com         C & C++   DMDScript  

D - BUG -ofFileNameWithSpaces and win32 menus in D (no bug:D)

reply davepermen <davepermen_member pathlink.com> writes:
i know this is minor.. but it's not possible to specify an executable filename
with spaces in it.. this would be nice.. as near all of my apps have a version
number in it, so it would be "App 1.exe", "Demo 2.exe", "Tutorial 3.exe", etc..

and currently i'm working at "D Editor.exe" (hehe, yeah, i know..:D).. would be
nice to spit it out as that, and not as DEditor.exe and rename..

this just as a hint for minor things..

btw, D is great. it lets one code nearly "declarative programming" (the thing
microsoft hypes with XAML for windows development on longhorn..)

my menu setup currently looks like this:

void initializeMenu() {
menu
(
"&File",
popup
("&New",&this.onFileNew)
("&Open...",&this.onFileOpen)
("&Close",&this.onFileClose)
("&Save",&this.onFileSave)
("E&xit",&this.onFileExit)
)
(
"&Edit",
popup
("&Cut",&this.onEditCut)
("&Copy",&this.onEditCopy)
("&Paste",&this.onEditPaste)
).set(windowHandle);
}

and yes, this generates a perfectly working win32 menu to my main window..
rather cool!
i first thought "oh my god, there aren't resourcefiles anymore for D.. i only
worked with them in vc".. but no, it was easy to wrap, the result is visible
here.. bether than the resourcefiles actually!
Nov 19 2003
parent reply Adam Harper <a-news-d harper.nu> writes:
davepermen wrote:
 i know this is minor.. but it's not possible to specify an executable filename
 with spaces in it.. this would be nice.. as near all of my apps have a version
 number in it, so it would be "App 1.exe", "Demo 2.exe", "Tutorial 3.exe", etc..
 
 and currently i'm working at "D Editor.exe" (hehe, yeah, i know..:D).. would be
 nice to spit it out as that, and not as DEditor.exe and rename..
 
 this just as a hint for minor things..
You can create an executable with a space in the file name, you just have to quote the file name on the command line. So, for example, on Windows if you wanted to create "program v1.exe" from "program.d" you'd enter the following command:
 dmd -of"'program 1'" program.d
You have to "double up" the quotes as the outside pair gets eaten when going from Windows -> DMD and never makes it through to the linker. You can put the quote pairs either way round (" before ', or ' before ") or use a second pair of the same quotes but escape them "\"like this\"". If you’re using DIGC then things get slightly more convulsed:
 digc -exe="\"'program v1'\"" program.d
For some reason you have to add yet another layer of quotes, this time escaping them (requirement of the Windows command line, not DIGC or DMD).
Nov 19 2003
parent davepermen <davepermen_member pathlink.com> writes:
thanks a lot! works great. still, dmd could resend everything with ""
surrounding, to solve this.. it looks sort of stooopid:D but cool, at least
working now! thanks

In article <bpga1j$qo9$1 digitaldaemon.com>, Adam Harper says...
davepermen wrote:
 i know this is minor.. but it's not possible to specify an executable filename
 with spaces in it.. this would be nice.. as near all of my apps have a version
 number in it, so it would be "App 1.exe", "Demo 2.exe", "Tutorial 3.exe", etc..
 
 and currently i'm working at "D Editor.exe" (hehe, yeah, i know..:D).. would be
 nice to spit it out as that, and not as DEditor.exe and rename..
 
 this just as a hint for minor things..
You can create an executable with a space in the file name, you just have to quote the file name on the command line. So, for example, on Windows if you wanted to create "program v1.exe" from "program.d" you'd enter the following command:
 dmd -of"'program 1'" program.d
You have to "double up" the quotes as the outside pair gets eaten when going from Windows -> DMD and never makes it through to the linker. You can put the quote pairs either way round (" before ', or ' before ") or use a second pair of the same quotes but escape them "\"like this\"". If you’re using DIGC then things get slightly more convulsed:
 digc -exe="\"'program v1'\"" program.d
For some reason you have to add yet another layer of quotes, this time escaping them (requirement of the Windows command line, not DIGC or DMD).
Nov 19 2003