@@ -1578,19 +1578,13 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
15781578 instance = NULL ;
15791579 }
15801580 }
1581- else if (cg -> home )
1581+ else if (cg -> userconfig )
15821582 {
15831583 /*
15841584 * No default in the environment, try the user's lpoptions files...
15851585 */
15861586
1587- #if _WIN32
1588- snprintf (filename , sizeof (filename ), "%s/AppData/Local/cups/lpoptions" , cg -> home );
1589- #elif defined(__APPLE__ )
1590- snprintf (filename , sizeof (filename ), "%s/Library/Application Support/cups/lpoptions" , cg -> home );
1591- #else
1592- snprintf (filename , sizeof (filename ), "%s/.cups/lpoptions" , cg -> home );
1593- #endif // _WIN32
1587+ snprintf (filename , sizeof (filename ), "%s/lpoptions" , cg -> userconfig );
15941588
15951589 dest_name = cups_get_default (filename , defname , sizeof (defname ), & instance );
15961590
@@ -1604,7 +1598,7 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
16041598 * Still not there? Try the system lpoptions file...
16051599 */
16061600
1607- snprintf (filename , sizeof (filename ), "%s/lpoptions" , cg -> cups_serverroot );
1601+ snprintf (filename , sizeof (filename ), "%s/lpoptions" , cg -> sysconfig );
16081602 dest_name = cups_get_default (filename , defname , sizeof (defname ), & instance );
16091603
16101604 if (dest_name )
@@ -1696,18 +1690,12 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
16961690 * Then add local options...
16971691 */
16981692
1699- snprintf (filename , sizeof (filename ), "%s/lpoptions" , cg -> cups_serverroot );
1693+ snprintf (filename , sizeof (filename ), "%s/lpoptions" , cg -> sysconfig );
17001694 cups_get_dests (filename , dest_name , instance , 0 , 1 , 1 , & dest );
17011695
1702- if (cg -> home )
1696+ if (cg -> userconfig )
17031697 {
1704- #if _WIN32
1705- snprintf (filename , sizeof (filename ), "%s/AppData/Local/cups/lpoptions" , cg -> home );
1706- #elif defined(__APPLE__ )
1707- snprintf (filename , sizeof (filename ), "%s/Library/Application Support/cups/lpoptions" , cg -> home );
1708- #else
1709- snprintf (filename , sizeof (filename ), "%s/.cups/lpoptions" , cg -> home );
1710- #endif // _WIN32
1698+ snprintf (filename , sizeof (filename ), "%s/lpoptions" , cg -> userconfig );
17111699
17121700 cups_get_dests (filename , dest_name , instance , 0 , 1 , 1 , & dest );
17131701 }
@@ -1853,34 +1841,21 @@ cupsSetDests(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
18531841 * Figure out which file to write to...
18541842 */
18551843
1856- snprintf (filename , sizeof (filename ), "%s/lpoptions" , cg -> cups_serverroot );
1844+ snprintf (filename , sizeof (filename ), "%s/lpoptions" , cg -> sysconfig );
18571845
1858- if (cg -> home )
1846+ if (cg -> userconfig )
18591847 {
18601848 /*
1861- * Create ~/.cups subdirectory...
1849+ * Create user subdirectory...
18621850 */
18631851
1864- #if _WIN32
1865- snprintf (filename , sizeof (filename ), "%s/AppData/Local/cups" , cg -> home );
1866- #elif defined(__APPLE__ )
1867- snprintf (filename , sizeof (filename ), "%s/Library/Application Support/cups" , cg -> home );
1868- #else
1869- snprintf (filename , sizeof (filename ), "%s/.cups" , cg -> home );
1870- #endif // _WIN32
1871- if (mkdir (filename , 0700 ) && errno != EEXIST )
1852+ if (mkdir (cg -> userconfig , 0700 ) && errno != EEXIST )
18721853 {
18731854 cupsFreeDests (num_temps , temps );
18741855 return (false);
18751856 }
18761857
1877- #if _WIN32
1878- snprintf (filename , sizeof (filename ), "%s/AppData/Local/cups/lpoptions" , cg -> home );
1879- #elif defined(__APPLE__ )
1880- snprintf (filename , sizeof (filename ), "%s/Library/Application Support/cups/lpoptions" , cg -> home );
1881- #else
1882- snprintf (filename , sizeof (filename ), "%s/.cups/lpoptions" , cg -> home );
1883- #endif // _WIN32
1858+ snprintf (filename , sizeof (filename ), "%s/lpoptions" , cg -> userconfig );
18841859 }
18851860
18861861 /*
@@ -3016,18 +2991,12 @@ cups_enum_dests(
30162991
30172992 user_default = _cupsGetUserDefault (data .def_name , sizeof (data .def_name ));
30182993
3019- snprintf (filename , sizeof (filename ), "%s/lpoptions" , cg -> cups_serverroot );
2994+ snprintf (filename , sizeof (filename ), "%s/lpoptions" , cg -> sysconfig );
30202995 data .num_dests = cups_get_dests (filename , NULL , NULL , 1 , user_default != NULL , data .num_dests , & data .dests );
30212996
3022- if (cg -> home )
2997+ if (cg -> userconfig )
30232998 {
3024- #if _WIN32
3025- snprintf (filename , sizeof (filename ), "%s/AppData/Local/cups/lpoptions" , cg -> home );
3026- #elif defined(__APPLE__ )
3027- snprintf (filename , sizeof (filename ), "%s/Library/Application Support/cups/lpoptions" , cg -> home );
3028- #else
3029- snprintf (filename , sizeof (filename ), "%s/.cups/lpoptions" , cg -> home );
3030- #endif // _WIN32
2999+ snprintf (filename , sizeof (filename ), "%s/lpoptions" , cg -> userconfig );
30313000
30323001 data .num_dests = cups_get_dests (filename , NULL , NULL , 1 , user_default != NULL , data .num_dests , & data .dests );
30333002 }
0 commit comments