Olivier wrote:
> For a project, I have to add a JPEG image.  Given the fact that each 
> developper
> has a local copy of the svn project, I would like to give a relative path 
> instead
> of a global one.  From what I understand, such path must be given relatively
> to the folder where GUI is executed !

        Relative paths work to whatever the current working directory (cwd) is.

        You can determine what the cwd is with getcwd(3)
        and you can change it with chdir(2)

        These are unix calls, but I think they're valid in Windows
        as well (they're both POSIX).

        If your program is invoked from a shell, the current directory
        will usually be the dir the shell was in at the time.

        But if the app is invoked from a desktop shortcut or a file
        browser (like the 'Finder'), then the OS gets to decide what
        the cwd is.

> How could I use a relative path valid at compilation time ?

        There shouldn't be anything special or unusual about FLTK's
        image functions; they should act just like fopen()/open().

        So if you specify a relative path such as "foo.jpg" or
        "./foo.jpg", it should resolve based on whatever the
        getcwd() path is.

        And if you want to set the cwd to something specific,
        put chdir() at the head of your program, so that all
        relative file references will work relative to that.

        HTH.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to