0

I am trying to make a Elementary OS app that I need to get user home folder. I tried GLib.Environment.get_home_dir () and Granite.Services.Paths.home_folder.get_path () but they both return null. What is the proper way to get user's home folder for Elementary OS?

0

This works for me:

    xdg_path = new Granite.Services.Paths();
    app_xdg_path.initialize (Constants.bookworm_id, Constants.INSTALL_SCRIPTS_DIR);
    bookworm_config_path = app_xdg_path.user_data_folder.get_path();

Are you missing the initialize step

| improve this answer | |
0

Granite.Services.Paths is now deprecated and uses GLib.Environment.get_home_dir () internally anyway.

If GLib.Environment.get_home_dir () is returning null, I believe there is probably something wrong with your setup/install as this method works on my system.

I believe it uses the HOME environment variable, so check this is set and isn't being overwritten by something else.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.