Re: glibmm g_mkdir_with_parents() function/method



On Thu, 2007-08-30 at 13:21 -0400, Jos�lburquerque wrote:
> Hi everyone.  I'm not subscribed to the gtkmm-list but I do have sort of
> a quick question on something I'm trying to accomplish  which I hope any
> of you can answer.  Would your answers pleased be cc'd to me?  Thanks.
> 
> My question is:  I'm trying to create a directory (with parents) within
> a c++ program.  I'm thinking of using gtkmm for the gui and looked all
> around the glibmm documentation to see if there was such a function (to
> create directories).  I noticed that glib has a g_mkdir_with_parents()
> function and I was wondering if this function exists for glibmm.  If so,
> can any of you point in the direction of its documentation?  If it
> doesn't, do any of you have a suggestion as to what I might do to create
> a directory?  Thanks so much.

If it is not wrapped in glibmm, you can always call the C function
(namely g_mkdir_with_parents()) from within your C++ code.

Also, in Gobby, we have a function that does probably the same as
g_mkdir_with_parents (which we did not use because gobby only requires
glib 2.6):

        void create_path_to(const std::string& to)
        {
                // Directory exists, nothing to do
                if(Glib::file_test(to, Glib::FILE_TEST_IS_DIR) )
                        return;

                // Find path to the directory to create
                std::string path_to = Glib::path_get_dirname(to);

                // Create this path, if it doesn't exists
                create_path_to(path_to);

                // Create new directory
                create_directory(to.c_str() );
        }

> -Jos�Armin

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