Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
path-prefix.cpp File Reference

path-prefix.cpp - Inkscape specific prefix handling More...

Go to the source code of this file.

Functions

static std::string _get_bundle_prefix_dir ()
 Guess the absolute path of the application bundle prefix directory.
 
char const * get_inkscape_datadir ()
 Determine the location of the Inkscape data directory (typically the share/ folder from where Inkscape should be loading resources).
 
void set_xdg_env ()
 Sets environment variables for a relocatable application bundle.
 
const char * get_user_config_dir ()
 Get the user configuration directory.
 
char const * get_program_name ()
 Gets the the currently running program's executable name (including full path)
 
char const * get_program_dir ()
 Gets the the full path to the directory containing the currently running program's executable.
 

Detailed Description

path-prefix.cpp - Inkscape specific prefix handling

Definition in file path-prefix.cpp.

Function Documentation

◆ _get_bundle_prefix_dir()

static std::string _get_bundle_prefix_dir ( )
static

Guess the absolute path of the application bundle prefix directory.

The result path is not guaranteed to exist.

On Windows, the result should be identical to g_win32_get_package_installation_directory_of_module(nullptr)

Definition at line 47 of file path-prefix.cpp.

References get_program_dir().

Referenced by get_inkscape_datadir().

◆ get_inkscape_datadir()

char const * get_inkscape_datadir ( )

Determine the location of the Inkscape data directory (typically the share/ folder from where Inkscape should be loading resources).

The data directory is the first of:

  • Environment variable $INKSCAPE_DATADIR if not empty
  • If a bundle is detected: "<bundle-prefix>/share"
  • Compile time value of INKSCAPE_DATADIR

Definition at line 79 of file path-prefix.cpp.

References _get_bundle_prefix_dir().

Referenced by Inkscape::IO::Resource::_get_path(), Inkscape::initialize_gettext(), Inkscape::UI::Dialog::InkscapePreferences::initPageSystem(), InkscapeApplication::on_handle_local_options(), print_system_data_directory(), set_themes_env(), and set_xdg_env().

◆ get_program_dir()

char const * get_program_dir ( )

Gets the the full path to the directory containing the currently running program's executable.

Returns
full path to directory encoded in native encoding, or NULL if it can't be determined

Definition at line 256 of file path-prefix.cpp.

References get_program_name().

Referenced by _get_bundle_prefix_dir(), main(), and set_extensions_env().

◆ get_program_name()

char const * get_program_name ( )

Gets the the currently running program's executable name (including full path)

Returns
executable name (including full path) encoded as UTF-8 or NULL if it can't be determined

Definition at line 193 of file path-prefix.cpp.

References buf, bufsize, len, name, and program_name.

Referenced by get_program_dir().

◆ get_user_config_dir()

const char * get_user_config_dir ( )

Get the user configuration directory.

Definition at line 181 of file path-prefix.cpp.

References set_xdg_env().

Referenced by Inkscape::IO::Resource::profile_path().

◆ set_xdg_env()

void set_xdg_env ( )

Sets environment variables for a relocatable application bundle.

Only does work on the first call, follow-up calls immediately return.

Only sets environment variables if this actually looks like a relocatable bundle.

Currently only handles macOS. Windows and Linux (AppImage) use alternative solutions.

Definition at line 112 of file path-prefix.cpp.

References get_inkscape_datadir(), and ready.

Referenced by get_user_config_dir(), and main().