Re: How would one set the current directory?



On Fri, 2010-11-05 at 19:12 -0700, Charles Hixson wrote: 
> On 11/03/2010 08:59 PM, Charles Hixson wrote:
> > I've looked, but outside I don't see any routine that's obviously 
> > intended for that purpose.  I suppose I could just use chdir(), but 
> > that seems like the wrong approach.  (Even if it works now, it's 
> > likely not to work some time in the future.)
> >
> >
> OK.  This is what I ended up with:
> #include <glib.h>
> #include <glibmm.h>
> #include <iostream>
> #include <glib/gstdio.h>
> ..
>      if    (g_chdir(dirPath->str) != 0)
>      {    std::cout <<    "Couldn't change current directory to:\n%s\n" <<
> ...
> That may be an extra include, but this worked, and I didn't feel like 
> experimenting more.

Sorry for the delay.  Was there a specific reason why you needed to
change directories in the app?  Keep in mind that there stream
manipulation classes in giomm that typically don't require changing
directories in the app:

http://library.gnome.org/devel/glibmm/unstable/group__Streams.html


-- 
José




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