tp-magic-config man moved to (1)

Magic tool documentation now split into separate files, and referenced
(as a directory) from README, so that users can find docs to any additional
tools (ones not included by default with Tux Paint) that are installed.
Added new --datadir option, to separate path to brushes/stamps/etc. from that of saved files.
Improved docs on where savedir default is.
Made sure --help, man tuxpaint, and OPTIONS docs all covered all command-line options.
Noted SDL_Pango makes locale-specific fonts unnecessary.
Added "--plugindocprefix" option to tp-magic-config, for where docs should go.
Improved plugin API documentation.
Improved layout of man pages a little.
This commit is contained in:
William Kendrick 2007-08-02 21:04:42 +00:00
parent ace762e890
commit adf56ef7e9
66 changed files with 1809 additions and 592 deletions

View file

@ -663,11 +663,12 @@ int load_user_fonts(SDL_Surface * screen, void *vp)
#endif
}
homedirdir = get_fname("fonts");
homedirdir = get_fname("fonts", DIR_DATA);
loadfonts(screen, homedirdir);
free(homedirdir);
#ifdef WIN32
homedirdir = get_fname("data/fonts");
homedirdir = get_fname("data/fonts", DIR_DATA);
loadfonts(screen, homedirdir);
free(homedirdir);
#endif

View file

@ -10,89 +10,71 @@
#include "debug.h"
char *savedir;
char *datadir;
/* The filename for the current image: */
char *get_fname(const char *const name)
char *get_fname(const char *const name, int kind)
{
char f[512];
const char *tux_settings_dir;
char * dir;
/* Where is the user's data directory?
This is where their saved files are stored,
local fonts, brushes and stamps can be found,
and where the "current_id.txt" file is saved */
/* DIR_SAVE: Where is the user's saved directory?
This is where their saved files are stored
and where the "current_id.txt" file is saved.
Windows predefines "savedir" as:
"C:\Documents and Settings\%USERNAME%\Application Data\TuxPaint"
though it may get overridden with "--savedir" option
BeOS similarly predefines "savedir" as "./userdata"...
Macintosh: It's under ~/Library/Application Support/TuxPaint
Linux & Unix: It's under ~/.tuxpaint
DIR_DATA: Where is the user's data directory?
This is where local fonts, brushes and stamps can be found. */
if (kind == DIR_SAVE)
dir = savedir;
else if (kind == DIR_DATA)
dir = datadir;
else
return NULL;
#ifdef WIN32
/* Windows predefines "savedir" as:
"C:\Documents and Settings\%USERNAME%\Application Data\TuxPaint"
though it may get overridden with "--savedir" option */
snprintf(f, sizeof(f), "%s/%s", savedir, name);
snprintf(f, sizeof(f), "%s/%s", dir, name);
#elif __BEOS__
/* BeOS similarly predefines "savedir" as "./userdata"... */
if (*name == '\0')
strcpy(f, savedir);
strcpy(f, dir);
else
snprintf(f, sizeof(f), "%s/%s", savedir, name);
#elif __APPLE__
/* Macintosh: It's under ~/Library/Application Support/TuxPaint */
tux_settings_dir = "Library/Application Support/TuxPaint";
#else
/* Linux & Unix: It's under ~/.tuxpaint */
tux_settings_dir = ".tuxpaint";
snprintf(f, sizeof(f), "%s/%s", dir, name);
#endif
/* Put together home directory path + settings directory + filename... */
if (savedir == NULL)
if (dir == NULL)
{
/* Save directory not overridden: */
fprintf(stderr, "Warning: get_fname() has a NULL dir...!?\n");
return strdup(name);;
}
if (getenv("HOME") != NULL)
{
if (*name == '\0')
{
/* (Some mkdir()'s don't like trailing slashes) */
if (*name != '\0')
{
/* (Some mkdir()'s don't like trailing slashes) */
snprintf(f, sizeof(f), "%s/%s", getenv("HOME"), tux_settings_dir);
}
else
{
snprintf(f, sizeof(f), "%s/%s/%s",
getenv("HOME"), tux_settings_dir, name);
}
}
else
{
/* WOAH! Don't know where HOME directory is! Last resort, use '.'! */
strcpy(f, name);
}
snprintf(f, sizeof(f), "%s/%s", dir, name);
}
else
{
/* User had overridden save directory with "--savedir" option: */
if (*name != '\0')
{
/* (Some mkdir()'s don't like trailing slashes) */
snprintf(f, sizeof(f), "%s/%s", savedir, name);
}
else
{
snprintf(f, sizeof(f), "%s", savedir);
}
snprintf(f, sizeof(f), "%s", dir);
}
return strdup(f);
}

View file

@ -6,8 +6,14 @@
#define GET_FNAME_H
extern char *savedir;
extern char *datadir;
char *get_fname(const char *const name);
enum {
DIR_SAVE,
DIR_DATA
};
char *get_fname(const char *const name, int kind);
#endif

View file

@ -1,86 +0,0 @@
.\" tp-magic-config - 2007.07.31
.TH TP-MAGIC-CONFIG 3 "31 Jul 2007" "2007.07.31" "Tux Paint Import"
.SH NAME
tp-magic-config -- Helps creating 'Magic' tool plugins for Tux Paint(1)
.SH SYNOPSYS
.TP 16
.B tp-magic-config [\-\-apiversion | \-\-version | \-\-cflags | \-\-pluginprefix | \-\-dataprefix]
.SH DESCRIPTION
\fItp-magic-config\fP is a simple shell script that responds with various
pieces of information about the currently-installed version of
\fITux Paint\fP(1) that are useful when building 'Magic' tool plugins.
.SH OPTIONS
.TP 8
.B \-\-apiversion
Outputs the version of the \fITux Paint\fP 'Magic' tool plugin API that the
installed copy of \fITux Paint\fP supports. (For API compatibility testing.)
.TP 8
.B \-\-version
Outputs the version of \fITux Paint\fP that \fItp-magic-config\fP
corresponds to.
.TP 8
.B \-\-cflags
Outputs the compiler flags that \fITux Paint\fP 'Magic' tool plugins should
be compiled with. (For example, a "\-I" include path option that tells the
compiler where it can find the plugin API header file, "tp_magic_config.h",
that plugins must #include.)
.TP 8
.B \-\-pluginprefix
Outputs the directory where the installed copy of \fITux Paint\fP expects
to find 'Magic' tool plugins (".so" shared objects).
.TP 8
.B \-\-dataprefix
Outputs the directory where the installed copy of \fITux Paint\fP keeps its
global data files (e.g., "/usr/share/tuxpaint/"). This is the same value that
plugins will receive in the "data_directory" string within the
"magic_api" structure sent to the plugins' functions.
.SH SHELL EXAMPLES
gcc -shared `tp-magic-config --cflags` my_plugin.c -o my_plugin.so
.PP
sudo cp my_plugin.so `tp-magic-config \-\-pluginprefix`
.PP
sudo cp my_plugin_icon.png `tp-magic-config \-\-dataprefix`/images/magic/
.SH MAKEFILE EXAMPLE
MAGIC_CFLAGS=$(shell tp-magic-config --cflags)
.br
MAGIC_PREFIX=$(shell tp-magic-config --pluginprefix)
.br
DATA_PREFIX=$(shell tp-magic-config --dataprefix)
.PP
all: my_plugin.so
.PP
my_plugin.so: my_plugin.c
.PP $(CC) -shared $(MAGIC_CFLAGS) my_plugin.c -o my_plugin.so
.PP
install: install-so install-data
.PP
install-so:
.br
mkdir -p $(MAGIC_PREFIX)
.br
cp my_plugin.so $(MAGIC_PREFIX)/
.br
chmod 644 $(MAGIC_PREFIX)/my_plugin.so
.PP
install-data:
.br
mkdir -p $(DATA_PREFIX)
.br
cp icons/my_plugin_icon.png $(DATA_PREFIX)/images/magic/
.br
chmod 644 $(DATA_PREFIX)/images/magic/my_plugin_icon.png
.SH AUTHOR
Bill Kendrick. <bill@newbreedsoftware.com>
.SH "SEE ALSO"
.BR tuxpaint (1),
.PP
And documentation within /usr/[local/]share/doc/tuxpaint/.

View file

@ -1,7 +1,7 @@
.\" tuxpaint.1 - 2007.07.24
.TH TUXPAINT 1 "24 July 2007" "0.9.18" "Tux Paint"
.\" tuxpaint.1 - 2007.08.02
.TH TUXPAINT 1 "2 August 2007" "0.9.18" "Tux Paint"
.SH NAME
tuxpaint -- A drawing program for young children.
tuxpaint -- "Tux Paint", a drawing program for young children.
.SH SYNOPSYS
.B tuxpaint
@ -10,62 +10,127 @@ tuxpaint -- A drawing program for young children.
.TP 9
.B tuxpaint
[\-\-fullscreen]
[\-\-native]
.br
[\-\-WIDTHxHEIGHT]
.br
[\-\-native]
.br
[\-\-orient=portrait]
.br
[\-\-startblank]
.br
[\-\-nosound]
.br
[\-\-noquit]
.br
[\-\-noprint]
.br
[\-\-printdelay=\fISECONDS\fP]
.br
[\-\-printcfg]
.br
[\-\-altprintalways | \-\-altprintnever]
.br
[\-\-papersize \fIPAPERSIZE\fP | \-\-papersize help]
.br
[\-\-simpleshapes]
.br
[\-\-uppercase]
.br
[\-\-grab]
.br
[\-\-noshortcuts]
.br
[\-\-nowheelmouse]
.br
[\-\-nobuttondistinction]
.br
[\-\-nofancycursors]
.br
[\-\-hidecursor]
.br
[\-\-nooutlines]
.br
[\-\-nostamps]
.br
[\-\-nostampcontrols]
.br
[\-\-mirrorstamps]
.br
[\-\-keyboard]
.br
[\-\-nosysfonts]
.br
[\-\-savedir \fIDIR\fP]
.br
[\-\-datadir \fIDIR\fP]
.br
[\-\-saveover]
.br
[\-\-saveovernew]
.br
[\-\-nosave]
.br
[\-\-autosave]
.br
[\-\-colorfile \fIFILE\fP]
.TP 9
.B tuxpaint (defaults)
[\-\-windowed]
.br
[\-\-800x600]
.br
[\-\-orient=landscape]
.br
[\-\-startlast]
.br
[\-\-sound]
.br
[\-\-quit]
.br
[\-\-print]
.br
[\-\-printdelay=0]
.br
[\-\-noprintcfg]
.br
[\-\-altprintmod]
.br
[\-\-complexshapes]
.br
[\-\-mixedcase]
.br
[\-\-dontgrab]
.br
[\-\-shortcuts]
.br
[\-\-wheelmouse]
.br
[\-\-buttondistinction]
.br
[\-\-fancycursors]
.br
[\-\-showcursor]
.br
[\-\-outlines]
.br
[\-\-stamps]
.br
[\-\-stampcontrols]
.br
[\-\-dontmirrorstamps]
.br
[\-\-mouse]
.br
[\-\-sysfonts]
.br
[\-\-saveoverask]
.br
[\-\-save]
.br
[\-\-noautosave]
.br
.TP 9
.B tuxpaint
@ -77,7 +142,9 @@ tuxpaint -- A drawing program for young children.
.TP 9
.B tuxpaint
[\-\-nosysconfig] [\-\-nolockfile]
[\-\-nosysconfig]
.br
[\-\-nolockfile]
.SH DESCRIPTION
.PP
@ -124,7 +191,16 @@ When in fullscreen mode, use the system's default screen resolution.
.B \-\-WIDTHxHEIGHT
Run \fITux Paint\fP in a particularly-sized window, or at a particular
fullscreen resolution (if \-\-native is not used). Default is 800x600.
Minimum is 640x480. Portrait and landscape orientations are both supported.
Minimum width is 640. Minimum height is 480. Portrait and landscape
orientations are both supported. (Also see \-\-orient, below.)
.TP 8
.B \-\-orient=landscape \-\-orient=portrait
If \-\-orient=portraitis set, asks \fITux Paint\fP to swap the WIDTH and HEIGHT
values it uses for windowed or fullscreen mode, without having to actually
change the WIDTH and HEIGHT values in the configuration file or on the
command-line. (This is useful on devices where the screen can be rotated,
e.g. tablet PCs.)
.TP 8
.B \-\-nosound \-\-sound
@ -148,14 +224,24 @@ seconds. Default is 0 (no limitation).
.TP 8
.B \-\-printcfg \-\-noprintcfg
(Windows only.) Enable or disable loading and saving of printer settings.
By default, \fITux Paint\fP will print to the default printer with default
settings. Pressing \fI[ALT]\fP while pushing the \fIPrint\fP button
will cause a Windows printer dialog to appear (as long as you're not in
fullscreen mode.) If \-\-printcfg is used, your previous settings will
(Windows and Mac OS X only.) Enable or disable loading and saving of
printer settings. By default, \fITux Paint\fP will print to the default
printer with default settings. Pressing \fI[ALT]\fP while pushing the
\fIPrint\fP button will cause a printer dialog to appear (as long as you're
not in fullscreen mode; see also \-\-altprintalways and \-\-altprintnever,
below.) Unless \-\-noprintcfg is used, your previous settings will
be loaded when \fITux Paint\fP starts up, and setting changes will be saved
for next time.
.TP 8
.B \-\-altprintmod \-\-altprintnever \-\-altprintalways
These options control whether an system printer dialog appears when the
user clicks the \fIPrint\fP button. By default (\-\-altprintmod), pressing
\fI[ALT]\fP while clicking \fIPrint\fP will bring up a dialog (unless you're
in fullscreen mode). With \-\-altprintalways, the dialog will always appear,
even if \fI[ALT]\fP is not being held. With \-\-altprintnever, the dialog
will never appear, even if \fI[ALT]\fP is being held.
.TP 8
.B \-\-papersize \fIPAPERSIZE\fP
(Only when PostScript printing is used \- not Windows, Mac OS X or BeOS.)
@ -254,8 +340,12 @@ use the \fInosysfonts\fP option to disable this feature.
.TP 8
.B \-\-savedir \fIDIR\fP
Specify where \fITux Paint\fP should save files. By default, this is
"~/.tuxpaint/saved" under Linux and Unix, and "userdata\\" under Windows.
Specify where \fITux Paint\fP should save files.
.TP 8
.B \-\-datadir \fIDIR\fP
Specify where \fITux Paint\fP should look for personal data files
(brushes, stamps, etc.).
.TP 8
.B \-\-saveover \-\-saveovernew \-\-saveoverask
@ -764,6 +854,7 @@ Martin Zhekov.
.SH "SEE ALSO"
.BR tuxpaint-import (1),
.BR tuxpaint-config (1),
.BR tp-magic-config (1),
.BR xpaint (1),
.BR gpaint (1),
.BR gimp (1),

View file

@ -26,11 +26,11 @@
# (See COPYING.txt)
# Note: "__VERSION__", "__APIVERSION__", "__INCLUDE__",
# "__PLUGINPREFIX__" and "__DATAPREFIX__" are replaced by
# values in Tux Paint's Makefile, via 'sed', by the 'make tp-magic-config'
# "__PLUGINPREFIX__", "__PLUGINDOCPREFIX__" and "__DATAPREFIX__" are replaced
# by values in Tux Paint's Makefile, via 'sed', by the 'make tp-magic-config'
# target.
# July 5, 2007 - July 31, 2007
# July 5, 2007 - August 2, 2007
if [ $# -ne 0 ]; then
@ -54,7 +54,11 @@ if [ $# -ne 0 ]; then
echo "__PLUGINPREFIX__"
exit
fi
if [ $1 = "--plugindocprefix" ]; then
echo "__PLUGINDOCPREFIX__"
exit
fi
fi
echo "Usage: tp-magic-config [--apiversion | --version | --cflags | --pluginprefix | --dataprefix]"
echo "Usage: tp-magic-config [--apiversion | --version | --cflags | --pluginprefix | --plugindocprefix | --dataprefix]"

View file

@ -4874,23 +4874,32 @@ static void show_usage(FILE * f, char *prg)
"Usage: %s {--usage | --help | --version | --verbose-version | --copying}\n"
"\n"
" %s [--windowed | --fullscreen]\n"
" %s [--WIDTHxHEIGHT | --native] [--orient=landscape | --orient=portrait]\n"
" %s [--startblank | --startlast ]\n"
" %s [--sound | --nosound] [--quit | --noquit]\n"
" %s [--print | --noprint] [--complexshapes | --simpleshapes]\n"
" %s [--WIDTHxHEIGHT | --native]\n"
" %s [--orient=landscape | --orient=portrait]\n"
" %s [--startblank | --startlast]\n"
" %s [--sound | --nosound]\n"
" %s [--quit | --noquit]\n"
" %s [--print | --noprint]\n"
" %s [--complexshapes | --simpleshapes]\n"
" %s [--mixedcase | --uppercase]\n"
" %s [--fancycursors | --nofancycursors | --hidecursor ]\n"
" %s [--mouse | --keyboard] [--dontgrab | --grab]\n"
" %s [--noshortcuts | --shortcuts] [--wheelmouse | --nowheelmouse]\n"
" %s [--nobuttondistinction | --buttondistinction ]\n"
" %s [--outlines | --nooutlines] [--stamps | --nostamps]\n"
" %s [--fancycursors | --nofancycursors]\n"
" %s [--hidecursor | --showcursor]\n"
" %s [--mouse | --keyboard]\n"
" %s [--dontgrab | --grab]\n"
" %s [--noshortcuts | --shortcuts]\n"
" %s [--wheelmouse | --nowheelmouse]\n"
" %s [--nobuttondistinction | --buttondistinction]\n"
" %s [--outlines | --nooutlines]\n"
" %s [--stamps | --nostamps]\n"
" %s [--sysfonts | --nosysfonts]\n"
" %s [--nostampcontrols | --stampcontrols]\n"
" %s [--mirrorstamps | --dontmirrorstamps]\n"
" %s [--saveoverask | --saveover | --saveovernew]\n"
" %s [--nosave | --save] [--autosave | --noautosave]\n"
" %s [--nosave | --save]\n"
" %s [--autosave | --noautosave]\n"
" %s [--savedir DIRECTORY]\n"
#ifdef WIN32
" %s [--datadir DIRECTORY]\n"
#if defined(WIN32) || defined(__APPLE__)
" %s [--printcfg | --noprintcfg]\n"
#endif
" %s [--printdelay=SECONDS]\n"
@ -4899,11 +4908,15 @@ static void show_usage(FILE * f, char *prg)
" %s [--papersize PAPERSIZE | --papersize help]\n"
#endif
" %s [--lang LANGUAGE | --locale LOCALE | --lang help]\n"
" %s [--nosysconfig] [--nolockfile]\n"
" %s [--nosysconfig]\n"
" %s [--nolockfile]\n"
" %s [--colorfile FILE]\n"
/* " %s [--record FILE | --playback FILE]\n" */
"\n",
prg, prg,
blank, blank, blank, blank,
blank, blank, blank,
blank, blank, blank,
blank, blank, blank,
blank, blank, blank,
blank, blank, blank, blank, blank, blank, blank, blank, blank,
@ -5519,7 +5532,7 @@ static void load_stamp_dir(SDL_Surface * screen, const char *const dir)
static void load_stamps(SDL_Surface * screen)
{
char *homedirdir = get_fname("stamps");
char *homedirdir = get_fname("stamps", DIR_DATA);
default_stamp_size = compute_default_scale_factor(1.0);
@ -5530,7 +5543,7 @@ static void load_stamps(SDL_Surface * screen)
#endif
#ifdef WIN32
free(homedirdir);
homedirdir = get_fname("data/stamps");
homedirdir = get_fname("data/stamps", DIR_DATA);
load_stamp_dir(screen, homedirdir);
#endif
@ -5688,13 +5701,41 @@ static void setup(int argc, char *argv[])
#ifdef WIN32
savedir = GetDefaultSaveDir("TuxPaint");
#elif __BEOS__
savedir = strdup("./userdata");
#else
savedir = NULL;
#endif
/* Windows */
savedir = GetDefaultSaveDir("TuxPaint");
datadir = GetDefaultDataDir("TuxPaint");
#elif __BEOS__
/* BeOS */
savedir = strdup("./userdata");
datadir = strdup("./userdata");
#else
/* Mac OS X & Linux */
if (getenv("HOME") != NULL)
{
char tmp[MAX_PATH];
snprintf(tmp, MAX_PATH, "%s/%s", getenv("HOME"),
#ifdef __APPLE__
"Library/Application Support/TuxPaint"
#else
".tuxpaint"
#endif
);
savedir = strdup(tmp);
datadir = strdup(tmp);
}
else
{
/* Woah, don't know where $HOME is? */
fprintf(stderr, "Error: You have no $HOME environment variable!\n");
exit(1);
}
#endif
/* Load options from global config file: */
@ -5739,7 +5780,7 @@ static void setup(int argc, char *argv[])
#if defined(WIN32)
/* Default local config file in users savedir directory on Windows */
snprintf(str, sizeof(str), "%s/tuxpaint.cfg", savedir);
snprintf(str, sizeof(str), "%s/tuxpaint.cfg", savedir); /* FIXME */
#elif defined(__BEOS__)
/* BeOS: Use a "tuxpaint.cfg" file: */
@ -6044,15 +6085,15 @@ static void setup(int argc, char *argv[])
}
else if (strcmp(argv[i], "--noprintcfg") == 0)
{
#ifndef WIN32
fprintf(stderr, "Note: printcfg option only applies to Windows!\n");
#if !defined(WIN32) && !defined(__APPLE__)
fprintf(stderr, "Note: printcfg option only applies to Windows and Mac OS X!\n");
#endif
use_print_config = 0;
}
else if (strcmp(argv[i], "--printcfg") == 0)
{
#ifndef WIN32
fprintf(stderr, "Note: printcfg option only applies to Windows!\n");
#if !defined(WIN32) && !defined(__APPLE__)
fprintf(stderr, "Note: printcfg option only applies to Windows and Mac OS X!\n");
#endif
use_print_config = 1;
}
@ -6126,6 +6167,26 @@ static void setup(int argc, char *argv[])
exit(1);
}
}
else if (strcmp(argv[i], "--datadir") == 0)
{
if (i < argc - 1)
{
if (datadir != NULL)
free(datadir);
datadir = strdup(argv[i + 1]);
remove_slash(datadir);
i++;
}
else
{
/* Forgot to specify the directory name! */
fprintf(stderr, "%s takes an argument\n", argv[i]);
show_usage(stderr, (char *) getfilename(argv[0]));
exit(1);
}
}
else if (strcmp(argv[i], "--record") == 0 ||
strcmp(argv[i], "--playback") == 0)
{
@ -6251,9 +6312,9 @@ static void setup(int argc, char *argv[])
/* Look for the lockfile... */
#ifndef WIN32
lock_fname = get_fname("lockfile.dat");
lock_fname = get_fname("lockfile.dat", DIR_SAVE);
#else
lock_fname = get_temp_fname("lockfile.dat");
lock_fname = get_temp_fname("lockfile.dat", DIR_SAVE);
#endif
fi = fopen(lock_fname, "r");
@ -6289,7 +6350,7 @@ static void setup(int argc, char *argv[])
/* Okay to run; create/update the lockfile */
/* (Make sure the directory exists, first!) */
homedirdir = get_fname("");
homedirdir = get_fname("", DIR_SAVE);
mkdir(homedirdir, 0755);
free(homedirdir);
@ -6978,11 +7039,11 @@ static void setup(int argc, char *argv[])
/* Load brushes: */
load_brush_dir(screen, DATA_PREFIX "brushes");
homedirdir = get_fname("brushes");
homedirdir = get_fname("brushes", DIR_DATA);
load_brush_dir(screen, homedirdir);
#ifdef WIN32
free(homedirdir);
homedirdir = get_fname("data/brushes");
homedirdir = get_fname("data/brushes", DIR_DATA);
load_brush_dir(screen, homedirdir);
#endif
@ -10401,7 +10462,7 @@ static void load_starter_id(char *saved_id)
int r, g, b;
snprintf(fname, sizeof(fname), "saved/%s.dat", saved_id);
rname = get_fname(fname);
rname = get_fname(fname, DIR_SAVE);
starter_id[0] = '\0';
@ -10457,7 +10518,7 @@ static void load_starter(char *img_id)
if (starter_personal == 0)
dirname = strdup(DATA_PREFIX "starters");
else
dirname = get_fname("starters");
dirname = get_fname("starters", DIR_DATA);
/* Clear them to NULL first: */
img_starter = NULL;
@ -10562,7 +10623,7 @@ static void load_current(void)
/* Determine the current picture's ID: */
fname = get_fname("current_id.txt");
fname = get_fname("current_id.txt", DIR_SAVE);
fi = fopen(fname, "r");
if (fi == NULL)
@ -10594,7 +10655,7 @@ static void load_current(void)
{
snprintf(ftmp, sizeof(ftmp), "saved/%s%s", file_id, FNAME_EXTENSION);
fname = get_fname(ftmp);
fname = get_fname(ftmp, DIR_SAVE);
tmp = IMG_Load(fname);
@ -10634,7 +10695,7 @@ static int make_directory(const char *path, const char *errmsg)
char *fname;
int res;
fname = get_fname(path);
fname = get_fname(path, DIR_SAVE);
res = mkdir(fname, 0755);
if (res != 0 && errno != EEXIST)
{
@ -10662,7 +10723,7 @@ static void save_current(void)
draw_tux_text(TUX_OOPS, strerror(errno), 0);
}
fname = get_fname("current_id.txt");
fname = get_fname("current_id.txt", DIR_SAVE);
fi = fopen(fname, "w");
if (fi == NULL)
@ -11360,9 +11421,9 @@ static void cleanup(void)
FILE *fi;
#ifndef WIN32
lock_fname = get_fname("lockfile.dat");
lock_fname = get_fname("lockfile.dat", DIR_SAVE);
#else
lock_fname = get_temp_fname("lockfile.dat");
lock_fname = get_temp_fname("lockfile.dat", DIR_SAVE);
#endif
zero_time = (time_t) 0;
@ -11802,7 +11863,7 @@ static int do_save(int tool, int dont_show_success_results)
/* Save the file: */
snprintf(tmp, sizeof(tmp), "saved/%s%s", file_id, FNAME_EXTENSION);
fname = get_fname(tmp);
fname = get_fname(tmp, DIR_SAVE);
debug(fname);
fi = fopen(fname, "wb");
@ -11835,7 +11896,7 @@ static int do_save(int tool, int dont_show_success_results)
/* (Was thumbnail in old directory, rather than under .thumbs?) */
snprintf(tmp, sizeof(tmp), "saved/%s-t%s", file_id, FNAME_EXTENSION);
fname = get_fname(tmp);
fname = get_fname(tmp, DIR_SAVE);
fi = fopen(fname, "r");
if (fi != NULL)
{
@ -11848,7 +11909,7 @@ static int do_save(int tool, int dont_show_success_results)
snprintf(tmp, sizeof(tmp), "saved/.thumbs/%s-t%s", file_id,
FNAME_EXTENSION);
fname = get_fname(tmp);
fname = get_fname(tmp, DIR_SAVE);
}
debug(fname);
@ -11880,7 +11941,7 @@ static int do_save(int tool, int dont_show_success_results)
canvas_color_b != 255)
{
snprintf(tmp, sizeof(tmp), "saved/%s.dat", file_id);
fname = get_fname(tmp);
fname = get_fname(tmp, DIR_SAVE);
fi = fopen(fname, "w");
if (fi != NULL)
{
@ -12165,7 +12226,7 @@ int do_open(void)
{
/* First, check for saved-images: */
dirname[places_to_look] = get_fname("saved");
dirname[places_to_look] = get_fname("saved", DIR_SAVE);
}
else if (places_to_look == PLACE_PERSONAL_STARTERS_DIR)
{
@ -12926,7 +12987,7 @@ int do_open(void)
snprintf(fname, sizeof(fname), "saved/%s%s",
d_names[which], d_exts[which]);
rfname = get_fname(fname);
rfname = get_fname(fname, DIR_SAVE);
debug(rfname);
if (unlink(rfname) == 0)
@ -12940,7 +13001,7 @@ int do_open(void)
"saved/.thumbs/%s-t.png", d_names[which]);
free(rfname);
rfname = get_fname(fname);
rfname = get_fname(fname, DIR_SAVE);
debug(rfname);
unlink(rfname);
@ -12952,7 +13013,7 @@ int do_open(void)
snprintf(fname, sizeof(fname), "saved/%s-t.png", d_names[which]);
free(rfname);
rfname = get_fname(fname);
rfname = get_fname(fname, DIR_SAVE);
debug(rfname);
unlink(rfname);
@ -12964,7 +13025,7 @@ int do_open(void)
snprintf(fname, sizeof(fname), "saved/%s.dat", d_names[which]);
free(rfname);
rfname = get_fname(fname);
rfname = get_fname(fname, DIR_SAVE);
debug(rfname);
unlink(rfname);
@ -13201,7 +13262,7 @@ int do_slideshow(void)
/* Load list of saved-images: */
dirname = get_fname("saved");
dirname = get_fname("saved", DIR_SAVE);
/* Read directory of images and build thumbnails: */
@ -14522,7 +14583,7 @@ void do_print(void)
char f[512];
int show = (want_alt_printcommand && !fullscreen);
snprintf(f, sizeof(f), "%s/%s", savedir, "print.cfg");
snprintf(f, sizeof(f), "%s/%s", savedir, "print.cfg"); // FIXME
{
const char *error =
@ -15176,16 +15237,16 @@ static void parse_options(FILE * fi)
}
else if (strcmp(str, "printcfg=yes") == 0)
{
#ifndef WIN32
fprintf(stderr, "Note: printcfg option only applies to Windows!\n");
#if !defined(WIN32) && !defined(__APPLE__)
fprintf(stderr, "Note: printcfg option only applies to Windows and Mac OS X!\n");
#endif
use_print_config = 1;
}
else if (strcmp(str, "printcfg=no") == 0 ||
strcmp(str, "noprintcfg=yes") == 0)
{
#ifndef WIN32
fprintf(stderr, "Note: printcfg option only applies to Windows!\n");
#if !defined(WIN32) && !defined(__APPLE__)
fprintf(stderr, "Note: printcfg option only applies to Windows and Mac OS X!\n");
#endif
use_print_config = 0;
}
@ -15248,6 +15309,15 @@ static void parse_options(FILE * fi)
#ifdef DEBUG
printf("savedir set to: %s\n", savedir);
#endif
}
else if (strstr(str, "datadir=") == str)
{
datadir = strdup(str + 8);
remove_slash(datadir);
#ifdef DEBUG
printf("datadir set to: %s\n", datadir);
#endif
}
}
@ -16698,7 +16768,7 @@ int do_new_dialog(void)
{
/* Check for coloring-book style 'starter' images in our folder: */
dirname[places_to_look] = get_fname("starters");
dirname[places_to_look] = get_fname("starters", DIR_DATA);
}
else if (places_to_look == PLACE_STARTERS_DIR)
{