Old 2nd February 2011, 02:40   #1
mvpetrovich
Junior Member
 
Join Date: Jan 2011
Posts: 5
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):

PHP Code:
  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:

PHP Code:
  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.
mvpetrovich is offline   Reply With Quote
Old 2nd February 2011, 16:32   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,275
Take a look at Verbs and File Associations on MSDN and you will see:

PHP Code:
command
(Default) = "%ProgramFiles%\MyProgram.exe" "%1" 
Your program is broken if it cannot handle: yourapp.exe "c:\somefile.ext"

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 2nd February 2011, 18:39   #3
mvpetrovich
Junior Member
 
Join Date: Jan 2011
Posts: 5
Quote:
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. :-)
mvpetrovich is offline   Reply With Quote
Old 2nd February 2011, 19:40   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,275
Quote:
Originally Posted by mvpetrovich View Post
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!

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 2nd February 2011, 20:11   #5
mvpetrovich
Junior Member
 
Join Date: Jan 2011
Posts: 5
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.
mvpetrovich is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
file association

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