[prev in list] [next in list] [prev in thread] [next in thread]
List: gnuplot-info-beta
Subject: Re: [PATCH] support XDG_CONFIG_HOME on macOS
From: Jun T <takimoto-j () kba ! biglobe ! ne ! jp>
Date: 2021-08-23 10:19:00
Message-ID: 49E7ECB6-B498-4351-881D-912D93D87168 () kba ! biglobe ! ne ! jp
[Download RAW message or body]
Sorry, this should be better.
Define USE_XDG_BASEDIR in xdg.h.
Jun
diff --git a/src/plot.c b/src/plot.c
index 8e91239cf..66fdb6e45 100644
--- a/src/plot.c
+++ b/src/plot.c
@@ -789,7 +789,7 @@ load_rcfile(int where)
PATH_CONCAT(rcfile, PLOTRC);
plotrc = fopen(rcfile, "r");
} else if (where == 3) {
-#ifdef __unix__
+#ifdef USE_XDG_BASEDIR
char * XDGConfigHome = xdg_get_var(kXDGConfigHome);
size_t len = strlen(XDGConfigHome);
rcfile = gp_alloc(len + 1 + sizeof("gnuplot/gnuplotrc"), "rcfile");
diff --git a/src/xdg.c b/src/xdg.c
index 93e4c227d..e6652d329 100644
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -2,7 +2,7 @@
#include "plot.h"
#include "util.h"
-#ifdef __unix__
+#ifdef USE_XDG_BASEDIR
#include <assert.h>
#include <stdio.h>
@@ -57,4 +57,4 @@ char *xdg_get_var(const XDGVarType idx) {
return XDGVar;
}
-#endif /* __unix__ */
+#endif /* USE_XDG_BASEDIR */
diff --git a/src/xdg.h b/src/xdg.h
index acfdda19d..cab5e1415 100644
--- a/src/xdg.h
+++ b/src/xdg.h
@@ -1,7 +1,9 @@
#ifndef GNUPLOT_XDG_H
#define GNUPLOT_XDG_H
-#ifdef __unix__
+#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+
+#define USE_XDG_BASEDIR
/* List of possible XDG variables */
typedef enum {
@@ -16,7 +18,7 @@ typedef enum {
char *xdg_get_var(const XDGVarType idx);
-#endif /* __unix__ */
+#endif /* USE_XDG_BASEDIR */
#endif /* GNUPLOT_XDG_H */
["macOS-xdg-v2.patch" (macOS-xdg-v2.patch)]
diff --git a/src/plot.c b/src/plot.c
index 8e91239cf..66fdb6e45 100644
--- a/src/plot.c
+++ b/src/plot.c
@@ -789,7 +789,7 @@ load_rcfile(int where)
PATH_CONCAT(rcfile, PLOTRC);
plotrc = fopen(rcfile, "r");
} else if (where == 3) {
-#ifdef __unix__
+#ifdef USE_XDG_BASEDIR
char * XDGConfigHome = xdg_get_var(kXDGConfigHome);
size_t len = strlen(XDGConfigHome);
rcfile = gp_alloc(len + 1 + sizeof("gnuplot/gnuplotrc"), "rcfile");
diff --git a/src/xdg.c b/src/xdg.c
index 93e4c227d..e6652d329 100644
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -2,7 +2,7 @@
#include "plot.h"
#include "util.h"
-#ifdef __unix__
+#ifdef USE_XDG_BASEDIR
#include <assert.h>
#include <stdio.h>
@@ -57,4 +57,4 @@ char *xdg_get_var(const XDGVarType idx) {
return XDGVar;
}
-#endif /* __unix__ */
+#endif /* USE_XDG_BASEDIR */
diff --git a/src/xdg.h b/src/xdg.h
index acfdda19d..cab5e1415 100644
--- a/src/xdg.h
+++ b/src/xdg.h
@@ -1,7 +1,9 @@
#ifndef GNUPLOT_XDG_H
#define GNUPLOT_XDG_H
-#ifdef __unix__
+#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+
+#define USE_XDG_BASEDIR
/* List of possible XDG variables */
typedef enum {
@@ -16,7 +18,7 @@ typedef enum {
char *xdg_get_var(const XDGVarType idx);
-#endif /* __unix__ */
+#endif /* USE_XDG_BASEDIR */
#endif /* GNUPLOT_XDG_H */
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@lists.sourceforge.net
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic