Makes our tuxpaint dir (in case it doesn't exist yet) before writing lockfile

This commit is contained in:
William Kendrick 2005-03-11 05:37:58 +00:00
parent b3239fcc61
commit aead0632b9
2 changed files with 14 additions and 5 deletions

View file

@ -120,6 +120,9 @@ http://www.newbreedsoftware.com/tuxpaint/
* Now uses "AUDIO_S16SYS" when initializing audio system * Now uses "AUDIO_S16SYS" when initializing audio system
(on Linux/Mac/BeOS); helps sound under Linux on Mac hardware. (on Linux/Mac/BeOS); helps sound under Linux on Mac hardware.
Albert Cahalan <albert@users.sourceforge.net> Albert Cahalan <albert@users.sourceforge.net>
* Made sure user directory existed before trying to create lockfile
(it might not be there the very first time we run Tux Paint).
* Interface improvements: * Interface improvements:
----------------------- -----------------------

View file

@ -22,12 +22,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (See COPYING.txt)
June 14, 2002 - February 13, 2005 June 14, 2002 - March 10, 2005
*/ */
#define VER_VERSION "0.9.15" #define VER_VERSION "0.9.15"
#define VER_DATE "2005-02-13" #define VER_DATE "2005-03-10"
/* Color depth for Tux Paint to run in, and store canvases in: */ /* Color depth for Tux Paint to run in, and store canvases in: */
@ -7715,6 +7715,7 @@ static void setup(int argc, char * argv[])
{ {
char * lock_fname; char * lock_fname;
time_t time_lock, time_now; time_t time_lock, time_now;
char * homedirdir;
/* Get the current time: */ /* Get the current time: */
@ -7753,6 +7754,12 @@ static void setup(int argc, char * argv[])
/* Okay to run; create/update the lockfile */ /* Okay to run; create/update the lockfile */
/* (Make sure the directory exists, first!) */
homedirdir = get_fname("");
mkdir(homedirdir, 0755);
free(homedirdir);
fi = fopen(lock_fname, "w"); fi = fopen(lock_fname, "w");
if (fi != NULL) if (fi != NULL)
{ {
@ -11464,10 +11471,9 @@ static char * get_fname(const char * const name)
strcpy(f, savedir); strcpy(f, savedir);
else else
snprintf(f, sizeof(f), "%s/%s", savedir, name); snprintf(f, sizeof(f), "%s/%s", savedir, name);
#else #else
/* On Mac, Linux and other Unixes, it's in a place under our home dir.: */
#ifdef __APPLE__ #ifdef __APPLE__
/* Macintosh: It's under ~/Library/Application Support/TuxPaint */ /* Macintosh: It's under ~/Library/Application Support/TuxPaint */