Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
dir-util.h File Reference

TODO: insert short description here. More...

Go to the source code of this file.

Functions

std::string sp_relative_path_from_path (std::string const &path, std::string const &base)
 Returns a form of path relative to base if that is easy to construct (eg if path appears to be in the directory specified by base), otherwise returns path.
 
char const * sp_extension_from_path (char const *path)
 
char * inkscape_rel2abs (char const *path, char const *base, char *result, size_t const size)
 Convert a relative path name into absolute.
 
char * inkscape_abs2rel (char const *path, char const *base, char *result, size_t const size)
 
char * prepend_current_dir_if_relative (char const *filename)
 

Detailed Description

TODO: insert short description here.

Definition in file dir-util.h.

Function Documentation

◆ inkscape_abs2rel()

char * inkscape_abs2rel ( char const *  path,
char const *  base,
char *  result,
size_t const  size 
)

Definition at line 159 of file dir-util.cpp.

References result, and size.

◆ inkscape_rel2abs()

char * inkscape_rel2abs ( char const *  path,
char const *  base,
char *  result,
size_t const  size 
)

Convert a relative path name into absolute.

If path is already absolute, does nothing except copying path to result.

Parameters
pathrelative path.
basebase directory (must be absolute path).
resultresult buffer.
sizesize of result buffer.
Returns
!= NULL: absolute path == NULL: error

based on functions by Shigio Yamaguchi. FIXME:TODO: force it to also do path normalization of the entire resulting path, i.e. get rid of any .. and . in any place, even if 'path' is already absolute (now it returns it unchanged in this case)

Definition at line 73 of file dir-util.cpp.

References current, parent, result, and size.

Referenced by prepend_current_dir_if_relative().

◆ prepend_current_dir_if_relative()

char * prepend_current_dir_if_relative ( char const *  filename)

◆ sp_extension_from_path()

char const * sp_extension_from_path ( char const *  path)

Definition at line 51 of file dir-util.cpp.

◆ sp_relative_path_from_path()

std::string sp_relative_path_from_path ( std::string const &  path,
std::string const &  base 
)

Returns a form of path relative to base if that is easy to construct (eg if path appears to be in the directory specified by base), otherwise returns path.

Parameters
pathis expected to be an absolute path.
baseis expected to be either empty or the absolute path of a directory.
Returns
a relative version of the path, if reasonable.
See also
inkscape_abs2rel for a more sophisticated version.
prepend_current_dir_if_relative.

Definition at line 21 of file dir-util.cpp.

References result.

Referenced by Inkscape::Shortcuts::get_file_names(), and Inkscape::Shortcuts::init().