Archive: InstallTTFFont - invalid file name


InstallTTFFont - invalid file name
Does anyone have a workaround for this problem?

I want to use InstallTTFFont to include files in my install package.

It works if I create a new folder D:\MyFont

However, all my other install files are in a folder who's root is D:\$MyApp\

The $ is being interpreted by NSIS as a special character!
Have tried (but failed) copying the path to a variable $0 using strcpy.

Too much work to rename $MyApp to something else...

Ideas?


use $$ to denote a $ in strings

that said.. why is your app in a $foldername? *watches red flags pop up*


Unfortunately, no difference...

The compiler says:

Push: D:\$$Medusa\Medusa-Store\Package-Items\Fonts\COPRGTB.TTF
Call "GetFileName"
Pop: $0
!insertmacro: end of GetFileNameCall
!define: "FontFileName"="$0"
SetOutPath: "$FONT_DIR"
IfFileExists: "$FONT_DIR\$0" ? Line129.6 :
File: "D:\$$Medusa\Medusa-Store\Package-Items\Fonts\COPRGTB.TTF" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in macro InstallTTFFont on macroline 14
Error in script "D:\$Medusa\Medusa-Store\Package-Items\Medusa_Fix_33112.nsi" on line 129 -- aborting creation process

My script is:
Section "Fonts" SEC08

StrCpy $FONT_DIR $FONTS
SetOutPath "$FONT_DIR"

!insertmacro InstallTTFFont "D:\$$Medusa\Medusa-Store\Package-Items\Fonts\COPRGTB.TTF"
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000

SectionEnd

The script works if if I replace d:\$$ etc with D:\MyFonts

(re the $ signs - it's purely to keep these files together at the top of the folder list - it's historical and goes back about 15 years!!!)


It's more hysterical, I'd say. Much better to use an _underscore than a $dollar sign...

Anyway, because File is (mostly) a compiletime command, I wouldn't be surprised if the parameter should be D:\$Medusa\, with a single dollar sign. After all, at compiletime all variables are empty, so it wouldn't make much sense to interpret $Medusa as a variable...
If this is the source of the problem, you'll probably need to modify the installTTFfont macro somewhat.

You could also add an !echo command to the installTTFfont macro, to see what the File command actually ends up being after the precompiler (before the File command is actually processed by the compiler). Maybe the macro does some strange things with the string.