Logo Search packages:      
Sourcecode: rapple version File versions  Download package

rpl_str_t rpl_fs_normalize_path ( rpl_str_t  path  ) 

Returns path resolved as an absolute path without trailing "/".

Parameters:
path Path.
Returns:
path resolved as an absolute path without trailing "/".

Definition at line 377 of file fsutil.c.

References rpl_fs_get_cwd(), rpl_me_free(), and rpl_me_malloc().

Referenced by rpl_cfg_get_config_filename(), rpl_cfg_get_ds_basedir(), rpl_cfg_get_linkchecker_html_report(), rpl_cfg_get_linkchecker_xml_report(), rpl_cfg_get_linkchecker_xslt(), rpl_cfg_get_logfile(), rpl_cfg_get_srcdir(), rpl_cfg_get_trf_catalog(), rpl_cfg_get_trf_tidy_config(), rpl_cfg_get_trf_tpl_xslt(), and rpl_cfg_get_webdir().

                                      {
    rpl_str_t n_path = NULL, cwd;

      assert(path != NULL);
      
    /* silently ignore NULL paths */
    if(path) {
        /* resolve relative paths */
        if (path[0] != '/') {
            cwd = rpl_fs_get_cwd();
            n_path = (rpl_str_t) rpl_me_malloc(strlen(cwd) + strlen(path) + 2);
            sprintf(n_path, "%s%s%s", cwd, "/", path);
            rpl_me_free (cwd);
        } else {
            n_path = (rpl_str_t) rpl_me_malloc(strlen(path) + 1);
            sprintf(n_path, "%s", path);
        }

        /* strip trailing "/" */
        if(n_path[strlen(n_path) - 1] == '/')
            n_path[strlen(n_path) -1] = '\0';
    }

    return n_path;
}


Generated by  Doxygen 1.6.0   Back to index