Help woth InstallDirRegKey
I am reading this value, c:\valve\steam\steamapps\dygear@aol.com\half-life, from HKCU "Software\Valve\Steam" "ModInstallPath"
but i want to get, c:\valve\steam\steamapps\dygear@aol.com, is there a way to do that?
Archive: Help woth InstallDirRegKey
Help woth InstallDirRegKey
I am reading this value, c:\valve\steam\steamapps\dygear@aol.com\half-life, from HKCU "Software\Valve\Steam" "ModInstallPath"
but i want to get, c:\valve\steam\steamapps\dygear@aol.com, is there a way to do that?
Search the forum for *steam*. This question has been asked and answered several times already.
I searched for InstallDirRegKey before I posted but did not find it, my bad.
Ok searched for Steam, and this is the most approte thread i could find. [link]
What i want to do is take the value from ModInstallPath and get the parent forlder. then set that to the Insall path.
I am going to try and make up some code later, but in that time if you could help with this then that would be great, I will no doubt have some qustions on how to do this later.
What's wrong with GetParent from that thread and from the documentation?
That code seems over kill.
This is what i want to do.
; Read registry value into $1
; for example, $1 = "c:\valve\steam\steamapps\dygear@aol.com\half-life"
Push $1
Call GetParent
Pop $0
; $0 = "c:\valve\steam\steamapps\dygear@aol.com"
; Start of Setting Install Dir
Function GetParent
Exch $0 ; old $0 is on top of stack
Push $1
Push $2
StrCpy $1 -1
loop:
StrCpy $2 $0 1 $1
StrCmp $2 "" exit
StrCmp $2 "\" exit
IntOp $1 $1 - 1
Goto loop
exit:
StrCpy $0 $0 $1
Pop $2
Pop $1
Exch $0 ; put $0 on top of stack, restore $0 to original value
FunctionEnd
Var InstallDir ;Declare the variable
Section InstallDir
StrCpy $InstallDir ReadRegStr HKCU Software\Valve\Steam ModInstallPath
Push $9
Call getParent
Pop $9
SectionEnd
; End of Setting Install Dir
change:
StrCpy $InstallDir ReadRegStr HKCU Software\Valve\Steam ModInstallPathto:
ReadRegStr$0 HKCU "Software\\Valve\\Steam" "ModInstallPath"
>StrCpy $INSTDIR "$0"
>; or
Var $InstallDir
ReadRegStr $InstallDir HKCU "Software\\Valve\\Steam" "ModInstallPath"
;Hope this works !
Function GetParent
Exch $0 ; old $0 is on top of stack
Push $1
Push $2
StrCpy $1 -1
loop:
StrCpy $2 $0 1 $1
StrCmp $2 "" exit
StrCmp $2 "\" exit
IntOp $1 $1 - 1
Goto loop
exit:
StrCpy $0 $0 $1
Pop $2
Pop $1
Exch $0 ; put $0 on top of stack, restore $0 to original value
FunctionEnd
Var InstallDir
Section InstallDir
ReadRegStr $InstallDir HKCU "Software\Valve\Steam" "ModInstallPath"
Push $InstallDir
Call GetParent
Pop $0
SectionEnd
InstallDir "$0"
Heres my code ...
Thanks.