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?


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

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.