in the following code snippet, i'm trying to get the full path for a
given file name (in argv[1]) using apr_file_get_info() and apr_stat().
in looking at apr_file_info.h, it appears that apr_finfo_t.fname should
contain the full path for the file after calling these functions, but it
does not. am i missing something, or is this just not working (i've
observed this behavior on both windows and redhat linux 7)?
thanks.
=============================
apr_pool_t *pool = 0;
apr_file_t *thefile = 0;
apr_finfo_t finfo1;
apr_finfo_t finfo2;
apr_int32_t flag = APR_READ;
apr_int32_t want = APR_FINFO_NAME;
const char* fname = 0;
apr_initialize();
atexit(apr_terminate);
apr_pool_create(&pool, NULL);
apr_file_open(&thefile, argv[1], flag, APR_UREAD, pool);
apr_file_name_get(&fname, thefile);
printf("fname = %s\n", fname);
apr_file_info_get(&finfo1, want, thefile);
printf("fname = %s\n", finfo1.fname);
apr_file_close(thefile);
apr_stat(&finfo2, argv[1], want, pool);
printf("fname = %s\n", finfo2.fname);
char real[PATH_MAX];
realpath(argv[1], real);
printf("realname = %s\n", real);
apr_pool_destroy(pool);