GrafX2 2.9.3227
The ultimate 256-color painting program
setup.h File Reference

Functions that determine where grafx2 is running, finds its data, and reads and writes configuration files. More...

+ This graph shows which files directly or indirectly include this file:

Macros

#define FONTS_SUBDIRECTORY   "fonts"
 Name of the subdirectory containing fonts, under the data directory (Get_data_directory()) More...
 
#define SKINS_SUBDIRECTORY   "skins"
 Name of the subdirectory containing fonts, under the data directory (Get_data_directory()) More...
 
#define SCRIPTS_SUBDIRECTORY   "scripts"
 Name of the subdirectory containing scripts. More...
 
#define LUALIB_SUBDIRECTORY   "libs"
 LUA directory prefix. More...
 
#define CONFIG_FILENAME   "gfx2.cfg"
 Name of the binary file containing some configuration settings. More...
 
#define INI_FILENAME   "gfx2.ini"
 Name of the text file containing some settings in INI format. More...
 
#define INISAVE_FILENAME   "gfx2.$$$"
 Name of the backup of the INI file. More...
 
#define INIDEF_FILENAME   "gfx2def.ini"
 Name of the default .INI file (read-only: gives .INI format and defaults) More...
 
#define DEFAULTPAL_FILENAME   "default.pal"
 Name of the default palette file. More...
 
#define SAFETYBACKUP_PREFIX_A   "a"
 Prefix for filenames of safety backups (main) More...
 
#define SAFETYBACKUP_PREFIX_B   "b"
 Prefix for filenames of safety backups (spare) More...
 
#define GFX2_ICON_FILENAME   "gfx2.gif"
 Name of the image file that serves as an application icon. More...
 
#define DEFAULT_SKIN_FILENAME   "skin_DPaint.png"
 Name of the image file for the default (and fallback) GUI skin. More...
 
#define DEFAULT_FONT_FILENAME   "font_DPaint.png"
 Name of the image file for the default (and fallback) 8x8 font. More...
 
#define BACKUP_FILE_EXTENSION   ".bkp"
 File extension for safety backups. More...
 
#define FONT_PREFIX   "font_"
 File prefix for fonts. More...
 
#define SKIN_PREFIX   "skin_"
 File prefix for skins. More...
 

Functions

char * Get_program_directory (const char *argv0)
 Determine which directory contains the executable. More...
 
char * Get_data_directory (const char *program_dir)
 Determine which directory contains the read-only data. More...
 
char * Get_config_directory (const char *program_dir)
 Determine which directory should store the user's configuration. More...
 

Detailed Description

Functions that determine where grafx2 is running, finds its data, and reads and writes configuration files.

Macro Definition Documentation

◆ FONTS_SUBDIRECTORY

#define FONTS_SUBDIRECTORY   "fonts"

Name of the subdirectory containing fonts, under the data directory (Get_data_directory())

◆ SKINS_SUBDIRECTORY

#define SKINS_SUBDIRECTORY   "skins"

Name of the subdirectory containing fonts, under the data directory (Get_data_directory())

◆ SCRIPTS_SUBDIRECTORY

#define SCRIPTS_SUBDIRECTORY   "scripts"

Name of the subdirectory containing scripts.

◆ LUALIB_SUBDIRECTORY

#define LUALIB_SUBDIRECTORY   "libs"

LUA directory prefix.

◆ CONFIG_FILENAME

#define CONFIG_FILENAME   "gfx2.cfg"

Name of the binary file containing some configuration settings.

◆ INI_FILENAME

#define INI_FILENAME   "gfx2.ini"

Name of the text file containing some settings in INI format.

◆ INISAVE_FILENAME

#define INISAVE_FILENAME   "gfx2.$$$"

Name of the backup of the INI file.

◆ INIDEF_FILENAME

#define INIDEF_FILENAME   "gfx2def.ini"

Name of the default .INI file (read-only: gives .INI format and defaults)

◆ DEFAULTPAL_FILENAME

#define DEFAULTPAL_FILENAME   "default.pal"

Name of the default palette file.

◆ SAFETYBACKUP_PREFIX_A

#define SAFETYBACKUP_PREFIX_A   "a"

Prefix for filenames of safety backups (main)

◆ SAFETYBACKUP_PREFIX_B

#define SAFETYBACKUP_PREFIX_B   "b"

Prefix for filenames of safety backups (spare)

◆ GFX2_ICON_FILENAME

#define GFX2_ICON_FILENAME   "gfx2.gif"

Name of the image file that serves as an application icon.

◆ DEFAULT_SKIN_FILENAME

#define DEFAULT_SKIN_FILENAME   "skin_DPaint.png"

Name of the image file for the default (and fallback) GUI skin.

◆ DEFAULT_FONT_FILENAME

#define DEFAULT_FONT_FILENAME   "font_DPaint.png"

Name of the image file for the default (and fallback) 8x8 font.

◆ BACKUP_FILE_EXTENSION

#define BACKUP_FILE_EXTENSION   ".bkp"

File extension for safety backups.

◆ FONT_PREFIX

#define FONT_PREFIX   "font_"

File prefix for fonts.

◆ SKIN_PREFIX

#define SKIN_PREFIX   "skin_"

File prefix for skins.

Function Documentation

◆ Get_program_directory()

char * Get_program_directory ( const char *  argv0)

Determine which directory contains the executable.

Parameters
argv0Main's argv[0], some platforms need it, some don't.
Returns
malloc'ed string. Trailing / or \ is kept. Note : in fact this is only used to check for the datafiles and fonts in this same directory.

References Extract_path(), Get_current_directory(), GFX2_DEBUG, GFX2_Log(), GFX2_WARNING, haiku_get_app_path(), MAX_PATH_CHARACTERS, NULL, PATH_MAX, and PATH_SEPARATOR.

Referenced by Init_program().

◆ Get_data_directory()

char * Get_data_directory ( const char *  program_dir)

Determine which directory contains the read-only data.

Returns
malloc'ed string
Parameters
program_dirThe directory containing the executable
Returns
the path. Trailing / or \ is kept.

References Filepath_append_to_dir(), Get_data_directory(), and PATH_MAX.

Referenced by Get_data_directory(), and Init_program().

◆ Get_config_directory()

char * Get_config_directory ( const char *  program_dir)

Determine which directory should store the user's configuration.

For most Unix and Windows platforms: If a config file already exists in program_dir, it will return it in priority (Useful for development, and possibly for upgrading from DOS version) If the standard directory doesn't exist yet, this function will attempt to create it (/root/.grafx2, or APPDATA%\GrafX2) If it cannot be created, this function will return the executable's own directory.

Parameters
program_dirThe directory containing the executable
Returns
malloc'ed string. Trailing / or \ is kept.

References CONFIG_FILENAME, Directory_create(), Directory_exists(), File_exists(), Filepath_append_to_dir(), GFX2_INFO, GFX2_Log(), GFX2_WARNING, MAX_PATH_CHARACTERS, PATH_SEPARATOR, and Portable_Installation_Detected.

Referenced by Init_program().