Re: How do I compute the full absolute path of a filename?



On Thu, May 11, 2000 at 04:29:29PM -0400, Daniel M. German wrote:
> I need to compute the absolute path name of a filename with respect to
> the application's current working directory. I have been looking
> around I cannot find it. I am sure it must exist somewhere. Do anybody
> know the name of the C function and its location?

You cehck for the path to be absolute and in case it's not prepend the cwd.
Something like:

if(g_path_is_absolute(filename))
	absfilename = g_strdup(filename);
else {
	char *cwd = g_get_current_dir();
	absfilename = g_strconcat(cwd, "/", filename, NULL);
	g_free(cwd);
}

George




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