+4 votes

Hello Everyone,

I'm wondering if there is a build-in way to get a user's home directory path in Windows and Mac?

The purpose will be to store a game configuration file there. The file will be read/write.

Thank you.

in Engine by (78 points)

3 Answers

+1 vote

you can save a file in user directory by using user:\

by (576 points)

It's user://, to be accurate.

Thank you both.

Note that this would point to a hidden directory on OSX and Linux, and to AppData on Windows.

+1 vote

There is OS.get_system_dir(int dir), but it seems you can't get the bare home directory this way, only downloads, documents etc.
I think however that it would be nice to be able to get the home folder with this function.

You can open an issue on github asking for this so an interrested contributor may implement it ^^

by (922 points)
+1 vote

This tutorial is about saving games, but it does answer your question.

by (64 points)

Great, thank you.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.