t.hall
7th January 2011 13:59 UTC
SethOutPath removes ':'
Hey.
I use this code to get a path to the programData folder:
Push $1
System::Call 'shell32::SHGetSpecialFolderPath(i $HWNDPARENT, t .r1, i ${CSIDL_COMMONAPPDATA}, i0)i.r0'
StrCpy $g_strSettingsDir " $1\${PRODUCT_PUBLISHER}\${MUI_STARTMENUPAGE_DEFAULTFOLDER} ${PRODUCT_VERSION}\${PRODUCT_NAME}"
MessageBox MB_ICONEXCLAMATION|MB_OK $g_strSettingsDir
Pop $1
When i print g_strSettingsDir in a dialog i get the correct path.
But when I use it with SetOutPath the ':' is removed from the path.
The dialog:
http://oi51.tinypic.com/2mwhs8g.jpg
And when I run the installer:
http://i56.tinypic.com/x0z72s.png
As you can see, the ':' is gone and the program won't install correctly
Any ideas of why this happens?
Edit: Topic should be SetOutPath...
// T.H
Anders
7th January 2011 21:25 UTC
StrCpy $g_strSettingsDir " $1\..." you have a leading space, that is probably the problem.
Any why system plugin?
Just use SetShellVarContext all + $APPDATA
Next time you use message box, remember to use messagebox mb_ok "|$var|" or something like that
t.hall
10th January 2011 08:05 UTC
StrCpy $g_strSettingsDir " $1\..." you have a leading space, that is probably the problem.
Thanks you!
Now it works! But why would that space remove ':'?
Anders
10th January 2011 11:35 UTC
I don't remember the specifics on how NSIS validates a path, but I know what a valid win32 path looks like:
c:\foo = full path to foo
:\foo = foo at root of current drive
c:foo = foo in current directory on drive c
foo:bar = alternative data stream named bar on filesystem object foo in current drive/directory
...so : as a drive separator can only appear as the 1st or 2nd character