+3 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.

asked Mar 4, 2016 in Engine by unknown llama (80 points)

3 Answers

+1 vote

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

answered Mar 4, 2016 by Mohammad Hadi Aliakb (575 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.

0 votes

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 ^^

answered Mar 4, 2016 by Hinsbart (912 points)
+1 vote

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

answered Mar 5, 2016 by dragoon (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.