Archive: Wild Card Folders?


Wild Card Folders?
I'm a little new to NSIS, so i dont know how i would do this,

I'm making a simple installer for Gmod users, to install a massive addons pack, and the folder names can change (only one really)

C:\Program Files\Steam\Steamapps\<name>\garrysmod\garrysmod

so ether A) have a page for the user to select what username to install or B) to install to all folders that have the garrysmod sub folder


Hi there!

Use SetOutPath [1] in conjunction with File [2].
I'm sure you'll find what you need!

[1] http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.1.9
[2] http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.1.5

Cheers

Bruno


Nope
I'm still lost, how would it be able to detect the right folder?


outfile test.exe
ShowInstDetails show

var name

page directory
page instfiles

Function .onInit
ReadRegStr $name HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer" "Logon User Name"
StrCpy $INSTDIR "$PROGRAMFILES\Steam\Steamapps\$name\garrysmod\garrysmod"
FunctionEnd

Section -
SetOutPath "$INSTDIR"
DetailPrint "$OUTDIR"
SectionEnd

You cant find it that way
Steam does not store the username in the registery


i think i might of found somthing

found this in the registery

HKEY_CLASSES_ROOT\Valve.Source\shell\open\command
"c:\program files\steam\steamapps\jrwr\garrysmod\hl2.exe" "%1"


ok i found where steam holds the login info

C:\Program Files\Steam\config\SteamAppData.vdf




"SteamAppData"
{
"RememberPassword" "1"
"AutoLoginUser" "jrwr"
"jrwr"
{
"User" "jrwr"
"AccountCreated" "1"
"ShowNotifyTrayHintDialog" "0"
}
}

There's a function in the NSIS wiki to get the steam install path and username.

http://nsis.sourceforge.net/Get_Stea...d_install_path

To make that function better...

Replace this line in GetSteamAccountName function:

IfFileExists "$R0\steamapps\$R2\*.*" done


With this one:
IfFileExists "$R0\steamapps\$R2\garrysmod\garrysmod\*.*" done


After that change the function returns the first user with garrysmod installed.

Thank you
Thank you sir (writes name down in installer)
(and Afrow UK)

Also a note: make sure your path is right, spent a hour looking at code to figure this out

old:
StrCpy $INSTDIR "$R1\$R0\SteamApps\garrysmod\garrysmod\addons"

new:
StrCpy $INSTDIR "$R1\SteamApps\$R0\garrysmod\garrysmod\addons"