Stores data in XDG_DATA_HOME instead of $HOME
This is for Flatpak compatibility
This commit is contained in:
parent
d83641e1be
commit
a7f06bb8ca
|
@ -455,14 +455,14 @@ int retVal;
|
|||
retVal = MCCIServerInitialize(portNumber);
|
||||
if (retVal) {
|
||||
/* Write port number to .mosaiccciport */
|
||||
char *home = getenv ("HOME"), *fnam;
|
||||
char *home = getenv ("XDG_DATA_HOME"), *fnam;
|
||||
FILE *fp;
|
||||
|
||||
if (!home)
|
||||
home = "/tmp";
|
||||
|
||||
fnam = (char *)malloc (strlen (home) + 32);
|
||||
sprintf (fnam, "%s/.mosaic/cciport", home); // SAM
|
||||
sprintf (fnam, "%s/cciport", home); // SAM
|
||||
|
||||
fp = fopen (fnam, "w");
|
||||
if (fp) {
|
||||
|
|
|
@ -506,7 +506,7 @@ mo_status mo_wipe_global_history (mo_window *win)
|
|||
static char *cached_global_hist_fname = NULL;
|
||||
mo_status mo_setup_global_history (void)
|
||||
{
|
||||
char *home = getenv ("HOME");
|
||||
char *home = getenv ("XDG_DATA_HOME");
|
||||
char *default_filename = get_pref_string(eGLOBAL_HISTORY_FILE);
|
||||
char *filename;
|
||||
FILE *fp;
|
||||
|
@ -530,7 +530,7 @@ mo_status mo_setup_global_history (void)
|
|||
printf(" the resource 'Mosaic*urlExpired').\n\n");
|
||||
printf("Your current history file will still exist and will not\n");
|
||||
printf(" be modified. However, it will no longer be updated.\n");
|
||||
printf(" Instead, the file '.mosaic/x-history' will be used.\n\n");
|
||||
printf(" Instead, the file 'x-history' will be used.\n\n");
|
||||
|
||||
free(filename);
|
||||
filename = (char *)malloc((strlen (home) + strlen (default_filename) + 8) * sizeof (char));
|
||||
|
|
|
@ -214,8 +214,8 @@ PopupItem *popup_build_user_defs()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
file = malloc(sizeof(char) * (strlen(str)+strlen("/.mosaic/user-defs")+1)); // SAM
|
||||
sprintf(file, "%s/.mosaic/user-defs", str); // SAM
|
||||
file = malloc(sizeof(char) * (strlen(str)+strlen("/user-defs")+1)); // SAM
|
||||
sprintf(file, "%s/user-defs", str); // SAM
|
||||
|
||||
free(str);
|
||||
|
||||
|
|
10
src/gui.c
10
src/gui.c
|
@ -3991,7 +3991,7 @@ static int mo_error_handler (Display *dsp, XErrorEvent *event)
|
|||
* remarks:
|
||||
*
|
||||
****************************************************************************/
|
||||
#define IMAGESELECT_FILENAME ".mosaic/imageselect-sites" // SAM
|
||||
#define IMAGESELECT_FILENAME "imageselect-sites" // SAM
|
||||
|
||||
void setup_imagekill(void) {
|
||||
|
||||
|
@ -4516,7 +4516,7 @@ splash_goto:
|
|||
|
||||
if (get_pref_string(ePERSONAL_EXTENSION_MAP))
|
||||
{
|
||||
char *home = getenv ("HOME");
|
||||
char *home = getenv ("XDG_DATA_HOME");
|
||||
|
||||
if (!home)
|
||||
home = "/tmp";
|
||||
|
@ -4535,7 +4535,7 @@ splash_goto:
|
|||
global_type_map = get_pref_string(eGLOBAL_TYPE_MAP);
|
||||
if (get_pref_string(ePERSONAL_TYPE_MAP))
|
||||
{
|
||||
char *home = getenv ("HOME");
|
||||
char *home = getenv ("XDG_DATA_HOME");
|
||||
|
||||
if (!home)
|
||||
home = "/tmp";
|
||||
|
@ -4673,14 +4673,14 @@ splash_goto:
|
|||
|
||||
/* Write pid into "~/.mosaicpid". */
|
||||
{
|
||||
char *home = getenv ("HOME"), *fnam;
|
||||
char *home = getenv ("XDG_DATA_HOME"), *fnam;
|
||||
FILE *fp;
|
||||
|
||||
if (!home)
|
||||
home = "/tmp";
|
||||
|
||||
fnam = (char *)malloc (strlen (home) + 32);
|
||||
sprintf (fnam, "%s/.mosaic/mosaicpid", home); // SAM
|
||||
sprintf (fnam, "%s/mosaicpid", home); // SAM
|
||||
|
||||
fp = fopen (fnam, "w");
|
||||
if (fp)
|
||||
|
|
|
@ -1180,7 +1180,7 @@ static mo_root_hotlist *mo_read_hotlist (char *filename, char *home)
|
|||
list = mo_new_root_hotlist(hotname, NULL);
|
||||
list->name = mo_read_new_hotlist((mo_hotlist *)list, fp);
|
||||
if (isnew==1) {
|
||||
fprintf(stderr,"Your hotlist has been updated to a new format!\n It is now called '.mosaic/hot.html'.\n");
|
||||
fprintf(stderr,"Your hotlist has been updated to a new format!\n It is now called 'hot.html'.\n");
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
@ -1295,7 +1295,7 @@ mo_status mo_dump_hotlist (mo_hotlist *list)
|
|||
*/
|
||||
mo_status mo_setup_default_hotlist (void)
|
||||
{
|
||||
char *home = getenv ("HOME");
|
||||
char *home = getenv ("XDG_DATA_HOME");
|
||||
char *default_filename = get_pref_string(eDEFAULT_HOTLIST_FILE);
|
||||
char *hot_filename = get_pref_string(eDEFAULT_HOT_FILE);
|
||||
char *filename;
|
||||
|
@ -1321,6 +1321,7 @@ mo_status mo_setup_default_hotlist (void)
|
|||
filename = (char *)malloc
|
||||
((strlen (home) + strlen (hot_filename) + 8) * sizeof (char));
|
||||
sprintf (filename, "%s/%s", home, hot_filename);
|
||||
fprintf(stderr, "%s\n", filename);
|
||||
default_hotlist = mo_new_root_hotlist (filename, "Default");
|
||||
}
|
||||
|
||||
|
|
|
@ -1291,7 +1291,7 @@ char *homedir,*ptr;
|
|||
fprintf(stderr,"home: Could not get your home directory.\n");
|
||||
return;
|
||||
}
|
||||
sprintf(fname,"%s/.mosaic/spoof-agents",homedir); // SAM
|
||||
sprintf(fname,"%s/spoof-agents",homedir); // SAM
|
||||
free(homedir);
|
||||
|
||||
if (!(fp=fopen(fname,"r"))) {
|
||||
|
|
|
@ -77,7 +77,7 @@ extern int srcTrace;
|
|||
/*
|
||||
This file contains support for personal annotations (pans).
|
||||
|
||||
We have a directory called ~/.mosaic/personal-annotations (by default).
|
||||
We have a directory called ~/personal-annotations (by default).
|
||||
In this directory is a file called LOG.
|
||||
|
||||
The LOG file consists of the following:
|
||||
|
@ -450,7 +450,7 @@ mo_status mo_setup_pan_list (void)
|
|||
|
||||
mo_init_pan ();
|
||||
|
||||
home = getenv ("HOME");
|
||||
home = getenv ("XDG_DATA_HOME");
|
||||
|
||||
/* This shouldn't happen. */
|
||||
if (!home)
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
#define PREFS_FILE_IO 0
|
||||
|
||||
#define PREFERENCES_FILENAME ".mosaic/preferences" // SAM
|
||||
#define PREFERENCES_FILENAME "preferences" // SAM
|
||||
#define PREFERENCES_MAJOR_VERSION 1
|
||||
#define PREFERENCES_MINOR_VERSION 0
|
||||
|
||||
|
|
|
@ -131,16 +131,16 @@ static XtResource resources[] = {
|
|||
#endif /* not _AIX */
|
||||
{ "globalHistoryFile", "GlobalHistoryFile", XtRString,
|
||||
sizeof (char *),
|
||||
offset (global_history_file), XtRString, ".mosaic/global-history" }, // SAM
|
||||
offset (global_history_file), XtRString, "global-history" }, // SAM
|
||||
{ "historyFile", "HistoryFile", XtRString,
|
||||
sizeof (char *),
|
||||
offset (history_file), XtRString, ".mosaic/x-history" }, // SAM
|
||||
offset (history_file), XtRString, "x-history" }, // SAM
|
||||
{ "defaultHotlistFile", "DefaultHotlistFile", XtRString,
|
||||
sizeof (char *),
|
||||
offset (default_hotlist_file), XtRString, ".mosaic/hotlist-default" }, // SAM
|
||||
offset (default_hotlist_file), XtRString, "hotlist-default" }, // SAM
|
||||
{ "defaultHotFile", "DefaultHotFile", XtRString,
|
||||
sizeof (char *),
|
||||
offset (default_hot_file), XtRString, ".mosaic/hot.html" }, // SAM
|
||||
offset (default_hot_file), XtRString, "hot.html" }, // SAM
|
||||
{ "addHotlistAddsRBM", "AddHotlistAddsRBM", XtRBoolean, sizeof (Boolean),
|
||||
offset (addHotlistAddsRBM), XtRString, "True" },
|
||||
{ "addRBMAddsRBM", "AddRBMAddsRBM", XtRBoolean, sizeof (Boolean),
|
||||
|
@ -148,7 +148,7 @@ static XtResource resources[] = {
|
|||
{ "personalAnnotationDirectory", "PersonalAnnotationDirectory", XtRString,
|
||||
sizeof (char *),
|
||||
offset (private_annotation_directory), XtRString,
|
||||
".mosaic/personal-annotations" }, // SAM
|
||||
"personal-annotations" }, // SAM
|
||||
/* Whether selections should be fancy, by default. */
|
||||
{ "fancySelections", "FancySelections", XtRBoolean,
|
||||
sizeof (Boolean), offset (default_fancy_selections),
|
||||
|
|
Reference in New Issue