simham_uk
16th February 2006 17:13 UTC
Hidden shares on UNC paths
Hi all
Its been a while since I've been around here...I hope everyone is as helpful as ever!
I'm trying to use strCpy to copy a UNC path with a hidden share but it seems to have trouble parsing the dollar sign in the path. I've tried double dollars to escape it but that makes things worse!
This is very similar to what I've been playing with:
Section ""
Var /GLOBAL uncpath
StrCpy $uncpath "\\filesrv01\myfolder$\inifile.ini"
ReadINIStr $R1 $uncpath MYSECTION myatt
MessageBox MB_OK "Value of R1 is '$R1'"
SectionEnd
Any ideas on how to make this work successfully or do I have to avoid hidden shares?
Instructor
16th February 2006 17:36 UTC
Section ""
Var /GLOBAL uncpath
StrCpy $uncpath "\\filesrv01\myfolder$$\inifile.ini"
MessageBox MB_OK "Value of $$uncpath is '$uncpath'"
SectionEnd
simham_uk
16th February 2006 18:30 UTC
Originally posted by Instructor
Section ""
Var /GLOBAL uncpath
StrCpy $uncpath "\\filesrv01\myfolder$$\inifile.ini"
MessageBox MB_OK "Value of $$uncpath is '$uncpath'"
SectionEnd
This is also what I tried but it fails...I dont care about the message box just the ini value but using that string in StrCpy ends up in error wiht the first char removed from the inifile.ini, looking at the output from the compile.
Any further suggestions?
Is this supposed to work?
BTW, I'm using the latest build downloaded from SF today, 2.14?
Thanks!
Comperio
16th February 2006 20:27 UTC
hmm... Your sample worked fine for me. What version of NSIS are you using? I've got 2.14.
My sample script:
name "test backslash"
outfile "Test Backslash.exe"
var mypath
Section
Sectionend
function .oninit
Setsilent silent
strcpy $mypath "\\filesrv01\myfolder$$\inifile.ini"
messagebox MB_OK "$$mypath = $mypath"
FunctionEnd
simham_uk
17th February 2006 10:13 UTC
Originally posted by Comperio
hmm... Your sample worked fine for me. What version of NSIS are you using? I've got 2.14.
My sample script:
name "test backslash"
outfile "Test Backslash.exe"
var mypath
Section
Sectionend
function .oninit
Setsilent silent
strcpy $mypath "\\filesrv01\myfolder$$\inifile.ini"
messagebox MB_OK "$$mypath = $mypath"
FunctionEnd
Yeah that works for me too. The problem seems to be that my inifile.ini actually begins with a "t"...so much for sanitising my examples. So the path is actually:
\\filesrv01\myfolder$$\tinifile.ini
Which generates an error (ignored) during compile.
My solution was to rename the inifile but I'm curious to know how to fix this issue when the inifile does begin with "t".
Thanks!
bhaelochon
17th February 2006 14:47 UTC
Might be a bug. It acts like it's interpreting the "$\t" as a tab character (reference) regardless of the escaped the dollar sign.
On the other hand, it could be a design decision.
Comperio
18th February 2006 02:19 UTC
Bug? Maybe..
But, here's a workaround (or a solution, depending on how you look it!)
name "test backslash"
outfile "Test Backslash.exe"
var mypath
var dol
Section
Sectionend
function .oninit
Setsilent silent
strcpy $dol "$$"
strcpy $mypath "\\filesrv01\myfolder$dol\tnifile.ini"
messagebox MB_OK "$$mypath = $mypath"
FunctionEnd