GnuCash
5.6-150-g038405b370+
|
File path resolution utility functions. More...
#include <glib.h>
Go to the source code of this file.
Functions | |
gchar * | gnc_resolve_file_path (const gchar *filefrag) |
The gnc_resolve_file_path() routine is a utility that will accept a fragmentary filename as input, and resolve it into a fully qualified path in the file system, i.e. More... | |
gchar * | gnc_file_path_relative_part (const gchar *prefix, const gchar *path) |
Given a prefix and a path return the relative portion of the path. More... | |
gchar * | gnc_file_path_absolute (const gchar *prefix, const gchar *relative) |
Given a prefix and a relative path, return the absolute path. More... | |
gchar * | gnc_path_find_localized_html_file (const gchar *file_name) |
Find an absolute path to a localized version of a given relative path to a html or html related file. More... | |
char * | gnc_filepath_init (void) |
Initializes the gnucash user data directory. More... | |
const gchar * | gnc_userdata_dir (void) |
Ensure that the user's configuration directory exists and is minimally populated. More... | |
gchar * | gnc_build_userdata_path (const gchar *filename) |
Make a path to filename in the user's gnucash data directory. More... | |
gchar * | gnc_build_userconfig_path (const gchar *filename) |
Make a path to filename in the user's configuration directory. More... | |
gchar * | gnc_build_book_path (const gchar *filename) |
Make a path to filename in the book subdirectory of the user's configuration directory. More... | |
gchar * | gnc_build_translog_path (const gchar *filename) |
Make a path to filename in the translog subdirectory of the user's configuration directory. More... | |
gchar * | gnc_build_data_path (const gchar *filename) |
Make a path to filename in the data subdirectory of the user's configuration directory. More... | |
gchar * | gnc_build_scm_path (const gchar *filename) |
Make a path to filename in the scm directory. More... | |
gchar * | gnc_build_report_path (const gchar *filename) |
Make a path to filename in the report directory. More... | |
gchar * | gnc_build_reports_path (const gchar *dirname) |
Make a path to dirname in the reports directory. More... | |
gchar * | gnc_build_stdreports_path (const gchar *filename) |
Make a path to filename in the standard reports directory. More... | |
const gchar * | gnc_userconfig_dir (void) |
Return the user's config directory for gnucash. More... | |
gchar * | gnc_filepath_locate_pixmap (const gchar *name) |
Given a pixmap/pixbuf file name, find the file in the pixmap directory associated with this application. More... | |
gchar * | gnc_filepath_locate_data_file (const gchar *name) |
Given a file name, find the file in the directories associated with this application. More... | |
gchar * | gnc_filepath_locate_ui_file (const gchar *name) |
Given a ui file name, find the file in the ui directory associated with this application. More... | |
gchar * | gnc_filepath_locate_doc_file (const gchar *name) |
Given a documentation file name, find the file in the doc directory associated with this application. More... | |
gboolean | gnc_filename_is_backup (const char *filename) |
gboolean | gnc_filename_is_datafile (const char *filename) |
File path resolution utility functions.
Definition in file gnc-filepath-utils.h.
gchar* gnc_build_book_path | ( | const gchar * | filename | ) |
Make a path to filename in the book subdirectory of the user's configuration directory.
filename | The name of the file |
Definition at line 1127 of file gnc-filepath-utils.cpp.
gchar* gnc_build_data_path | ( | const gchar * | filename | ) |
Make a path to filename in the data subdirectory of the user's configuration directory.
filename | The name of the file |
Definition at line 1159 of file gnc-filepath-utils.cpp.
gchar* gnc_build_report_path | ( | const gchar * | filename | ) |
Make a path to filename in the report directory.
filename | The name of the file |
Definition at line 1193 of file gnc-filepath-utils.cpp.
gchar* gnc_build_reports_path | ( | const gchar * | dirname | ) |
Make a path to dirname in the reports directory.
dirname | The name of the subdirectory |
Definition at line 1211 of file gnc-filepath-utils.cpp.
gchar* gnc_build_scm_path | ( | const gchar * | filename | ) |
Make a path to filename in the scm directory.
filename | The name of the file |
Definition at line 1175 of file gnc-filepath-utils.cpp.
gchar* gnc_build_stdreports_path | ( | const gchar * | filename | ) |
Make a path to filename in the standard reports directory.
filename | The name of the file |
Definition at line 1229 of file gnc-filepath-utils.cpp.
gchar* gnc_build_translog_path | ( | const gchar * | filename | ) |
Make a path to filename in the translog subdirectory of the user's configuration directory.
filename | The name of the file |
Definition at line 1143 of file gnc-filepath-utils.cpp.
gchar* gnc_build_userconfig_path | ( | const gchar * | filename | ) |
Make a path to filename in the user's configuration directory.
filename | The name of the file |
Definition at line 1093 of file gnc-filepath-utils.cpp.
gchar* gnc_build_userdata_path | ( | const gchar * | filename | ) |
Make a path to filename in the user's gnucash data directory.
filename | The name of the file |
Definition at line 1078 of file gnc-filepath-utils.cpp.
gchar* gnc_file_path_absolute | ( | const gchar * | prefix, |
const gchar * | relative | ||
) |
Given a prefix and a relative path, return the absolute path.
prefix | The prefix that is the head of the path |
relative | The path to add to the prefix to form an absolute path |
If prefix is null, then the gnc_userdata_home is used as the prefix.
Definition at line 1039 of file gnc-filepath-utils.cpp.
gchar* gnc_file_path_relative_part | ( | const gchar * | prefix, |
const gchar * | path | ||
) |
Given a prefix and a path return the relative portion of the path.
prefix | The prefix that might be the first part of the path |
path | The path from which the prefix might be removed |
Definition at line 209 of file gnc-filepath-utils.cpp.
char* gnc_filepath_init | ( | void | ) |
Initializes the gnucash user data directory.
This function should be called very early at startup (before any other of the user data directory related function gets called).
Definition at line 911 of file gnc-filepath-utils.cpp.
gchar* gnc_filepath_locate_data_file | ( | const gchar * | name | ) |
Given a file name, find the file in the directories associated with this application.
This routine will display an error message if it can't find the file.
name | The name of the file to be found. |
Definition at line 1262 of file gnc-filepath-utils.cpp.
gchar* gnc_filepath_locate_doc_file | ( | const gchar * | name | ) |
Given a documentation file name, find the file in the doc directory associated with this application.
This routine will display an error message if it can't find the file.
name | The name of the file to be found. |
Definition at line 1301 of file gnc-filepath-utils.cpp.
gchar* gnc_filepath_locate_pixmap | ( | const gchar * | name | ) |
Given a pixmap/pixbuf file name, find the file in the pixmap directory associated with this application.
This routine will display an error message if it can't find the file.
name | The name of the file to be found. |
Definition at line 1271 of file gnc-filepath-utils.cpp.
gchar* gnc_filepath_locate_ui_file | ( | const gchar * | name | ) |
Given a ui file name, find the file in the ui directory associated with this application.
This routine will display an error message if it can't find the file.
name | The name of the file to be found. |
Definition at line 1286 of file gnc-filepath-utils.cpp.
gchar* gnc_path_find_localized_html_file | ( | const gchar * | file_name | ) |
Find an absolute path to a localized version of a given relative path to a html or html related file.
If no localized version exists, an absolute path to the file is searched for. If that file doesn't exist either, returns NULL.
If passed a string which g_path_is_absolute declares an absolute path, return the argument.
Otherwise, assume that file_name is a well-formed relative path and try to find a file with its path relative to
The paths are searched for in that order. If a matching file is found, return the absolute path to it.
If one isn't found, return NULL.
file_name | The file path to resolve |
If no localized version exists, an absolute path to the file is searched for. If that file doesn't exist either, returns NULL.
If passed a string which g_path_is_absolute declares an absolute path, return the argument.
Otherwise, assume that file_name is a well-formed relative path and try to find a file with its path relative to
The paths are searched for in that order. If a matching file is found, return the absolute path to it.
If one isn't found, return NULL.
file_name | The file path to resolve |
Definition at line 304 of file gnc-filepath-utils.cpp.
gchar* gnc_resolve_file_path | ( | const gchar * | filefrag | ) |
The gnc_resolve_file_path() routine is a utility that will accept a fragmentary filename as input, and resolve it into a fully qualified path in the file system, i.e.
a path that begins with a leading slash. First, the current working directory is searched for the file. Next, the directory $HOME/.gnucash/data, and finally, a list of other (configurable) paths. If the file is not found, then the path $HOME/.gnucash/data is used. If $HOME is not defined, then the current working directory is used.
The gnc_resolve_file_path() routine is a utility that will accept a fragmentary filename as input, and resolve it into a fully qualified path in the file system, i.e.
If passed a string which g_path_is_absolute declares an absolute path, return the argument.
Otherwise, assume that filefrag is a well-formed relative path and try to find a file with its path relative to
The paths are searched for in that order. If a matching file is found, return the absolute path to it.
If one isn't found, return a absolute path relative to the user's configuration directory and note in the trace file that it needs to be created.
filefrag | The file path to resolve |
Definition at line 155 of file gnc-filepath-utils.cpp.
const gchar* gnc_userconfig_dir | ( | void | ) |
Return the user's config directory for gnucash.
Definition at line 1001 of file gnc-filepath-utils.cpp.
const gchar* gnc_userdata_dir | ( | void | ) |
Ensure that the user's configuration directory exists and is minimally populated.
Note that the default path depends on the platform.
If any of these paths don't exist and can't be created the function will fall back to
Definition at line 980 of file gnc-filepath-utils.cpp.