Archive: probs with GetParent


probs with GetParent
hey all!

when i'm using the function GetParent i have something like that:

original: C:\tools\totalcmd
after calling function: C:\tools\totalcmd or C:\tools\totalcmd-9

the function:
Function GetParent

Exch $R0
Push $R1
Push $R2
Push $R3

StrCpy $R1 0
StrLen $R2 $R0

loop:
IntOp $R1 $R1 + 1
IntCmp $R1 $R2 get 0 get
StrCpy $R3 $R0 1 -$R1
StrCmp $R3 "\" get
Goto loop

get:
StrCpy $R0 $R0 -$R1

Pop $R3
Pop $R2
Pop $R1
Exch $R0

FunctionEnd

i call function like that:

Push "$EXEDIR\"
Call GetParent
Pop $R0

FileWrite $0 "Editor=$R0"

(it's an entry in a configfile)

someone an idea? thx!


replace Push "$EXEDIR\" by Push "$EXEDIR" and it will work fine!


Or:

Name "Output"
OutFile "Output.exe"

!include "FileFunc.nsh"
!insertmacro GetParent

Section
${GetParent} "$EXEDIR\" $R0

MessageBox MB_OK "$R0"
SectionEnd