How can I get to a Steam game folder without hardcoding it?
Instead of hardcoding C:\Steam\steamapps\common\<game_folder>\GameData
in my code can I use something involving the steamappid
of a game to obtain this information automatically?
In order to obtain a Steam games folder you have to follow this steps:
acf
files and libraryfolders.vdf
You can find Steam InstallPath
in windows registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Valve\Steam
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Valve\Steam
You can read a Value from a Registry Key using this code:
Dim strSteamInstallPath as String = My.Computer.Registry.GetValue(
"HKEY_LOCAL_MACHINE\SOFTWARE\Valve\Steam", "InstallPath", Nothing)
MsgBox("The install path is " & strSteamInstallPath)
Once you have Steam main folder (the one containing steam.exe
) you can read games installation folder from appmanifest_<steamappid>.acf
files contained in \steamapps
subfolder.
For example, appmanifest_2280.acf
contains informations about Ultimate Doom
.
You can search for a particular steamappid
or analyze every files and get game name from name
key.
Also check libraryfolders.vdf
in \steamapps
subfolder for other game installation folders.
For example I have some games in D:\mygames
so my libraryfolders.vdf
is:
"LibraryFolders"
{
"TimeNextStatsReport" "xxxxxxxxxxx"
"ContentStatsID" "xxxxxxxxxxx"
"1" "D:\\mygames"
}
Once you have this alternative folder, check for acm
files contained in \steamapps
subfolder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With