So I have a working directory for MacOS installation folder but now I need to work out how to use the Windows directories. Is there any way to access the program files of windows devices, as I need to access steam through there.
Need help getting steam directory on Windows devices
The registry has SteamPath
in HKEY_CURRENT_USER\Software\Valve\Steam
. Note that the macos path isn't guaranteed here - I have a system where the app is in /opt
.
What's your objective?
Cakestax To get the default directory on C: you can use %ProgramFiles(x86)%\Steam\steamapps\common
as your prefix.
But why do you need that? Keep in mind that people often have more than one location where they install their games. For example I have a Steam apps folder on drive C: and E:.
If you really need to know where someone installed a game you should ask them and let them pick a directory. Although of course it cannot hurt to check some default locations and try to find it yourself first but in the end you should ask.
spaceyjase I just need the steam folder so I can access a file called "userdata" used to store .json files for saves.
Cakestax In case you are making a game for Steam you should use the Steam API.
https://godotengine.org/asset-library/asset?filter=steam&category=&godot_version=&cost=&sort=updated
Cakestax Wouldn't you be writing to the user://
file system?
spaceyjase yeah but I don't know the file path for steam from user://
Toxe Ok after some digging I found out how to get the correct directory regardless of where somebody stores steam on their device. But I have one last problem:
When printing the applications file path (Which should be the games steam installation folder)
On windows it works great, however because of how Mac works, I get this result:
Now the bit I highlighted in red is the part that I DONT want. I just want to get to common/Plethora as this is the installation folder. (I also don't need plethora.app)
So to work backwards I tried to add on ../MacOS../Contents../Plethora.app../Plethora/userdata/
to the end but this didn't work.
To sum up, I just need to get to the common/Plethora folder somehow through this directory. Maybe some way to get the parenting files and work my way to the installation folder as I have everything here that I need.
- Edited
I'm still not sure what you're trying to achieve - if you're in the game's base/install directory, aren't you then also in godot's file system res://
and user://
? I don't follow why you need to know about anything outside of the game's folder structure; the game should be agnostic to Steam's location.
edit: if you’re looking to Steam to cloud save, that’s configurable in Steamworks and you should save to a known path, like those provided by godot (which go into the user’s data folders); you’d then select this path in the app’s Steam page. It’s not something you need to ‘code’.