diff options
-rw-r--r-- | doc/sciteco.1.in | 7 | ||||
-rw-r--r-- | src/main.cpp | 17 |
2 files changed, 23 insertions, 1 deletions
diff --git a/doc/sciteco.1.in b/doc/sciteco.1.in index 077d807..16df9c4 100644 --- a/doc/sciteco.1.in +++ b/doc/sciteco.1.in @@ -168,6 +168,13 @@ On all other platforms (including UNIX/Linux) this variable defaults to the standard library installation path at .BR "@scitecolibdir@" . . +.LP +Both the \fBSCITECOCONFIG\fP and \fBSCITECOPATH\fP environment +variables are canonicalized to absolute paths. +Therefore it is possible to define them relative to the +working directory of \*(ST when it starts up while macros +can work with the corresponding registers to locate files +even when the working directory of \*(ST is changed later on. . .SH FILES . diff --git a/src/main.cpp b/src/main.cpp index a2de09e..f17f942 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -166,9 +166,12 @@ process_options(int &argc, char **&argv) static inline void initialize_environment(const gchar *program) { - gchar *default_configpath; + gchar *default_configpath, *abs_path; gchar **env; + /* + * Initialize $SCITECOCONFIG and $SCITECOPATH + */ default_configpath = get_default_config_path(program); g_setenv("SCITECOCONFIG", default_configpath, FALSE); #ifdef G_OS_WIN32 @@ -181,6 +184,18 @@ initialize_environment(const gchar *program) #endif g_free(default_configpath); + /* + * $SCITECOCONFIG and $SCITECOPATH may still be relative. + * They are canonicalized, so macros can use them even + * if the current working directory changes. + */ + abs_path = get_absolute_path(g_getenv("SCITECOCONFIG")); + g_setenv("SCITECOCONFIG", abs_path, TRUE); + g_free(abs_path); + abs_path = get_absolute_path(g_getenv("SCITECOPATH")); + g_setenv("SCITECOPATH", abs_path, TRUE); + g_free(abs_path); + env = g_listenv(); for (gchar **key = env; *key; key++) { |