Old 22nd October 2004, 20:02   #1
jay.smith
Junior Member
 
Join Date: Oct 2004
Posts: 6
Java Class with $ causes error

I have a java class that has a dollar sign in the name when is compiled.

Anyone have any ideas how to make the following work?

File "MyApp\LibMessageDigester$MyHandler.class"

Wanted to try to escape it with \ but that will be considered part of the path?

File "MyApp\LibMessageDigester\$MyHandler.class"


Any pointers greatly appreciated.

Jay Smith
jay.w.smith@tyson.com
jay.smith is offline   Reply With Quote
Old 22nd October 2004, 20:11   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Use $$.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 22nd October 2004, 20:44   #3
jay.smith
Junior Member
 
Join Date: Oct 2004
Posts: 6
Thanks for the quick reply but that did not work, did I do it wrong?

File: MyApp\LibMessageDigester$$MyHandler.class" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] filespec [...]|/oname=outfile one_file_only)
Error in script "C:\Temp\NSIS SCRIPTS\SST.nsi" on line 59 -- aborting creation process
jay.smith is offline   Reply With Quote
Old 22nd October 2004, 20:50   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Hmm... Thinking about it again, it shouldn't even process the dollar sign, so there is no reason to escape it. I have just tested it and it works fine. Make sure you got the path right.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 22nd October 2004, 21:36   #5
jay.smith
Junior Member
 
Join Date: Oct 2004
Posts: 6
I forgot that the orginal files get deleted, the installer piece works ok, complains of an undefined variable in the uninstall section with the DELETE "my$StupidFile.class" but the installer does build.

It doesn't remove that file during uninstall. Thanks for you help I really appreciate you taking the time.

Jay
jay.smith is offline   Reply With Quote
Old 22nd October 2004, 21:41   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
In the Delete line you need double dollar sign because it is parsed.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 22nd October 2004, 21:58   #7
jay.smith
Junior Member
 
Join Date: Oct 2004
Posts: 6
Tried that and it does not complain about the undefined variable but still doesn't remove the file at uninstall time.

Thanks, I will just but it in the known issues list and roll on. Maybe there will be a solution for it in the future.

Thanks again.
jay.smith is offline   Reply With Quote
Old 22nd October 2004, 22:01   #8
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You should specify a full path when using delete. Use:
code:
Delete $INSTDIR\my$$StupidFile.class

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 22nd October 2004, 22:02   #9
jay.smith
Junior Member
 
Join Date: Oct 2004
Posts: 6
This is the actual line I am using
Delete "C:\Program Files\cognos\crn\sdk\java\ExecReportsInstall\ExecReportsUI$$MenuHandler.class"
jay.smith is offline   Reply With Quote
Old 22nd October 2004, 22:07   #10
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Try verifying the path and make sure it's not in use.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 22nd October 2004, 22:07   #11
jay.smith
Junior Member
 
Join Date: Oct 2004
Posts: 6
And man are you fast at reading these post. I have neve seen responses this fast.

Ok, that did work changed it from C:\Program Files\cognos\crn\sdk\java\ExecReportsInstall to $INSTDIR and it started working. Dummy me, I wasn't pointed to the install dir at all.

Thanks so much for humor a stupid programmer, today I am worn out. It's working and you were a great help.

Jay
jay.smith is offline   Reply With Quote
Old 28th January 2008, 13:58   #12
FkYkko
Junior Member
 
Join Date: Jan 2008
Posts: 3
Hi, I've got a question related to this long dead thread's discussion:

I'm making an installer which will contain Java-files containing $-signs in the filename. I'm also using the
Uninstall log. The specific macro I'm having some problems with is.

; File macro
!macro File FilePath FileName
IfFileExists "$OUTDIR\${FileName}" +2
FileWrite $UninstLog "$OUTDIR\${FileName}$\r$\n"
File "${FilePath}${FileName}"
!macroend
!define File "!insertmacro File"


When I add files using e.g

code:
${File} "c:\Muppet$Kermit.txt"


it generates warnings since both the IfFileExists and FileWrite are runtime and will think $Kermit.txt is a variable and can't find it.

I'm using a external script which generates these lines in an autobuild enviroment so there would not be any problem generating

code:
${File} "c:\Muppet$$Kermit.txt"


instead, but this results in an "file not found" error.



Is there anyway to make IfFileExists and File behave the same regarding variable names?

Or

Is there another uninstall log which is recommended for use? (since these macros doesn't seem to have changed for a couple of years)

Or do I have to rewrite these macros to change the string for the IfFileExists command? (uglyfying the code)
FkYkko is offline   Reply With Quote
Old 28th January 2008, 17:16   #13
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
I think the easiest solution in this case would be uglyfying the code.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump