wsutil: Add get_docfile_path()

This commit is contained in:
João Valverde 2023-01-20 10:14:38 +00:00
parent d45a733258
commit 597bcca9ee
2 changed files with 31 additions and 0 deletions

View File

@ -2129,6 +2129,28 @@ get_datafile_path(const char *filename)
}
}
/*
* Construct the path name of a global documentation file, given the
* file name.
*
* The returned file name was g_malloc()'d so it must be g_free()d when the
* caller is done with it.
*/
char *
get_docfile_path(const char *filename)
{
if (running_in_build_directory_flag) {
/* We're running in the build directory and the requested file is a
* generated (or a test) file. Return the file name in the build
* directory (not in the source/data directory).
* (Oh the things we do to keep the source directory pristine...)
*/
return g_build_filename(get_progfile_dir(), filename, (char *)NULL);
} else {
return g_build_filename(get_doc_dir(), filename, (char *)NULL);
}
}
/*
* Return an error message for UNIX-style errno indications on open or
* create operations.

View File

@ -136,6 +136,15 @@ WS_DLL_PUBLIC const char *get_doc_dir(void);
* The returned file name was g_malloc()'d so it must be g_free()d when the
* caller is done with it.
*/
WS_DLL_PUBLIC char *get_docfile_path(const char *filename);
/*
* Construct the path URL of a global documentation file, given the
* file name.
*
* The returned file name was g_malloc()'d so it must be g_free()d when the
* caller is done with it.
*/
WS_DLL_PUBLIC char *doc_file_url(const char *filename);
/*