Re: Current Working Directory



Nick Watts writes:
How can I set the cwd to the path my app is in?

Do you mean the process's working directory, or the file selector's
default directory? I'll answer the former.

        char buffer[1000];
        char *app_dir;
        GetModuleFileName (NULL, buffer, sizeof (buffer));

        app_dir = g_path_get_dirname (buffer);
        g_chdir (app_dir);
        g_free (app_dir);

(Untested. Add checks for error returns.)

--tml




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