Mark Mcvittie wrote:
> I found this bug with getcwd() on Mac,

        Do you mean with fl_getcwd()?
        Which version of OSX?

> it doesn't happen in Linux and I haven't tried Windows.
> What happens is that on OSX it always returns a path 'Users/username'.
> Can anyone confirm or explain?

        From what I can tell, it seems to operate the way I'd expect,
        but let's see how you're encountering it.

        Here's what I get just casually exercising it against getcwd(),
        seems to do what I'd expect:

sh-3.2# cat foo.cxx
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/param.h>
#include <FL/Fl.H>

int main() {
    char buf[MAXPATHLEN];

    getcwd(buf, sizeof(buf));
    printf("   getcwd(buf) returned: %s\n", buf);
    buf[0] = 0;         // clear after use for next call

    fl_getcwd(buf, sizeof(buf));
    printf("fl_getcwd(buf) returned: %s\n", buf);

    char *cwd = getcwd(0, MAXPATHLEN);
    printf("   getcwd(0,0) returned: %s\n", cwd);
    free((void*)cwd);

    cwd = fl_getcwd(0, MAXPATHLEN);
    printf("fl_getcwd(0,0) returned: %s\n", cwd);
    free((void*)cwd);

    return(0);
}

sh-3.2# make foo
*** Compile foo.cxx...
*** Linking foo...

sh-3.2# ./foo
   getcwd(buf) returned: /usr/local/src/fltk-1.3.x-svn/examples
fl_getcwd(buf) returned: /usr/local/src/fltk-1.3.x-svn/examples
   getcwd(0,0) returned: /usr/local/src/fltk-1.3.x-svn/examples
fl_getcwd(0,0) returned: /usr/local/src/fltk-1.3.x-svn/examples

sh-3.2# pwd
/usr/local/src/fltk-1.3.x-svn/examples
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to