Re: Default dir for application data



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/08/09 16:06, Todor Todorov wrote:
Hello list

I skimmed the docs for the current stable release on gtk.org, but was
not able to find anything relating to my problem. If for example my
application is installed globally with DATA_DIR set to /usr/share, is
there some function in GLib or GTK which would give me the global app
data dir (i.e. /usr/share/MyApp) or the user owned app data dir (i.e.
$HOME/.config/MyApp) - either as an GFile or path (gchar*)?

Thanks for your help!

Regards,
Todor

I use something like this..

    filename = g_strdup_printf("%s/%s", g_get_user_config_dir(),context);
    if (!g_file_test(filename, G_FILE_TEST_IS_DIR)) {
        g_mkdir_with_parents(filename, 0775);
    }
    g_free(filename);

    store->keyfile = g_key_file_new();
    filename = g_strdup_printf("%s/%s/%s.conf",
g_get_user_config_dir(),context,context);
    g_key_file_load_from_file(store->keyfile,
                              filename,
                              G_KEY_FILE_KEEP_COMMENTS |
G_KEY_FILE_KEEP_TRANSLATIONS, NULL);



- -- 
Get my public GnuPG key from
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7D0BD5D1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkrOZfUACgkQ6w2kMH0L1dE0sQCgiiNNLVYQesWi77FpDBT1gEDD
HUcAoIa43d9nHDVQc2VS62xd8syqylvU
=gYJL
-----END PGP SIGNATURE-----



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]