mvpetrovich
2nd February 2011 03:40 UTC
FileAssociation.nsh Registry Error
In FileAssociation.nsh there are two lines that I believe should be changed (the first and last of the following three):
WriteRegStr HKCR "$R0\shell\open\command" "" '"$R2" "%1"'
WriteRegStr HKCR "$R0\shell\edit" "" "Edit $R0"
WriteRegStr HKCR "$R0\shell\edit\command" "" '"$R2" "%1"'
This should be:
WriteRegStr HKCR "$R0\shell\open\command" "" '"$R2" %1'
WriteRegStr HKCR "$R0\shell\edit" "" "Edit $R0"
WriteRegStr HKCR "$R0\shell\edit\command" "" '"$R2" %1'
Parentheses should not be around the %1. When they are there, the parameter is not set, and the file will not open in the desired software.
Anders
2nd February 2011 17:32 UTC
Take a look at Verbs and File Associations on MSDN and you will see:
command
>(Default) = "%ProgramFiles%\MyProgram.exe" "%1"
Your program is broken if it cannot handle: yourapp.exe "c:\somefile.ext"
mvpetrovich
2nd February 2011 19:39 UTC
Your program is broken if it cannot handle: yourapp.exe "c:\somefile.ext"
This seemed odd to me, as I thought about this after I posted. Actually, the software is not broken, but uses some very old technology. This code goes back to around 1998. I directly read the command line and process the file using the text after the program name. Back in those days, we did not have parameters passed to an array. Looks like it is time to enter the modern world. :-)
Anders
2nd February 2011 20:40 UTC
Originally posted by mvpetrovich
Actually, the software is not broken, but uses some very old technology.
Any app written for Win95 or later needs to be able to handle long paths with spaces and wrapped in quotes, if it can't, it is BROKEN!
mvpetrovich
2nd February 2011 21:11 UTC
Correct. I was parsing the command line myself, and quotes were not needed. My programs took long file names, and only used one parameter. What I did not do was allow quotes, since I did not need any delimiters. I just moved from InstallShield to NSIS (and love it). My InstallShield setups did not use quotes in the association, so that is how I missed it. It has been running like that for 12 years. I'll use the parameter array in the next release to be more compliant.