Re: How to create a new directory?



Hi Gerardo,

I think you're looking for Gio::File, and some of its friends:
http://developer.gnome.org/glibmm/unstable/classGio_1_1File.html#abfa05e23e95e77cabac289ab4e294a58

The most simple version is this:
Gio::File::make_directory()

Hope that helps, -Harry

On Sun, Apr 15, 2012 at 7:28 PM, Gerardo Ballabio <gerardo ballabio gmail com> wrote:
Hi all,
can you please tell me what is the recommended and most portable way
to create a new directory in a gtkmm program?

Browsing the glibmm documentation I didn't found any interface for
creating a new directory.  If I read correctly, class Glib::Dir
provides a read-only interface that only allows to read existing
directories.

I want specifically to create a directory where to store user-specific
data for a game (configuration settings, scores etc.).  Functions like
Glib::get_user_config_dir and Glib::get_user_data_dir return suggested
paths where to store application data (on my Debian system they are
$HOME/.config and $HOME/.local/share respectively), but most
applications don't write their files directly there: rather, they
create their own subdirectories.  I want to do the same.

I might use the Unix mkdir system call, but then my program wouldn't
be portable to non-Unix systems.  Is there a more general solution?

Thanks in advance
 Gerardo
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list



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