WIN32 only:

Change use_print_config (printcfg) default to be yes.
Create the 'lockfile.dat' in the users local temporary directory, usually:
'C:\Documents and Settings\<USER NAME>\Local Settings\Temp\'. This allows
the use of a shared 'savedir' without messing up the lockfile.
This commit is contained in:
John Popplewell 2007-04-28 02:52:11 +00:00
parent c43e81eb48
commit a85bc639be
3 changed files with 36 additions and 1 deletions

View file

@ -5988,7 +5988,7 @@ static void setup(int argc, char *argv[])
dont_load_stamps = 0;
no_system_fonts = 1;
print_delay = 0;
use_print_config = 0;
use_print_config = 1;
mirrorstamps = 0;
disable_stamp_controls = 0;
@ -6511,7 +6511,11 @@ static void setup(int argc, char *argv[])
/* Look for the lockfile... */
#ifndef WIN32
lock_fname = get_fname("lockfile.dat");
#else
lock_fname = get_temp_fname("lockfile.dat");
#endif
fi = fopen(lock_fname, "r");
if (fi != NULL)
@ -11330,7 +11334,11 @@ static void cleanup(void)
time_t zero_time;
FILE *fi;
#ifndef WIN32
lock_fname = get_fname("lockfile.dat");
#else
lock_fname = get_temp_fname("lockfile.dat");
#endif
zero_time = (time_t) 0;

View file

@ -576,3 +576,29 @@ char *GetSystemFontDir(void)
}
return strdup("C:\\WINDOWS\\FONTS");
}
/*
Returns heap string containing user temp directory.
E.g. C:\Documents and Settings\jfp\Local Settings\Temp
*/
static char *GetUserTempDir(void)
{
char *temp = getenv("TEMP");
if (!temp)
{
temp = "userdata";
}
return strdup(temp);
}
char *get_temp_fname(const char *const name)
{
char f[512];
char *tempdir = GetUserTempDir();
snprintf(f, sizeof(f), "%s/%s", tempdir, name);
free(tempdir);
return strdup(f);
}

View file

@ -22,5 +22,6 @@ extern int IsPrinterAvailable(void);
/* additional windows functions requiring <windows.h> */
extern char *GetDefaultSaveDir(const char *suffix);
extern char *GetSystemFontDir(void);
extern char *get_temp_fname(const char *const name);
#endif