@@ -158,9 +158,12 @@ cups_globals_alloc(void)
158158#ifdef _WIN32
159159 HKEY key ; // Registry key
160160 DWORD size ; // Size of string
161+ const char * userprofile = getenv ("USERPROFILE" );
162+ // User profile (home) directory
163+ char userconfig [1024 ], // User configuration directory
164+ * userptr ; // Pointer into user config
161165 static char installdir [1024 ] = "" , // Install directory
162166 sysconfig [1024 ] = "" ; // Server configuration directory
163- char userconfig [1024 ] = "" , // User configuration directory
164167#endif // _WIN32
165168
166169
@@ -226,25 +229,22 @@ cups_globals_alloc(void)
226229 if ((cg -> sysconfig = getenv ("CUPS_SERVERROOT" )) == NULL )
227230 cg -> sysconfig = sysconfig ;
228231
229- if (!userconfig [0 ])
230- {
231- const char * userprofile = getenv ("USERPROFILE" );
232- // User profile (home) directory
233- char * userptr ; // Pointer into user profile
234-
235- DEBUG_printf ("cups_globals_alloc: USERPROFILE=\"%s\"" , userprofile );
232+ DEBUG_printf ("cups_globals_alloc: USERPROFILE=\"%s\"" , userprofile );
236233
234+ if (userprofile )
237235 snprintf (userconfig , sizeof (userconfig ), "%s/AppData/Local/cups" , userprofile );
238- for (userptr = userconfig ; * userptr ; userptr ++ )
239- {
240- // Convert back slashes to forward slashes
241- if (* userptr == '\\' )
242- * userptr = '/' ;
243- }
236+ else
237+ cupsCopyString (userconfig , "C:/cups" , sizeof (userconfig ));
244238
245- DEBUG_printf ("cups_globals_alloc: userconfig=\"%s\"" , userconfig );
239+ for (userptr = userconfig ; * userptr ; userptr ++ )
240+ {
241+ // Convert back slashes to forward slashes
242+ if (* userptr == '\\' )
243+ * userptr = '/' ;
246244 }
247245
246+ DEBUG_printf ("cups_globals_alloc: userconfig=\"%s\"" , userconfig );
247+
248248 cg -> userconfig = strdup (userconfig );
249249
250250#else
0 commit comments