diff --git a/src/System/Boot/init_texmacs.cpp b/src/System/Boot/init_texmacs.cpp index e8d2851ae7..44c24229a4 100644 --- a/src/System/Boot/init_texmacs.cpp +++ b/src/System/Boot/init_texmacs.cpp @@ -172,18 +172,22 @@ void init_texmacs_home_path (int& argc, char** argv) { if (!is_empty (get_env ("TEXMACS_HOME_PATH"))) return; -#if defined(OS_MINGW) || defined(OS_WIN) - set_env ("TEXMACS_HOME_PATH", get_env ("APPDATA") * "\\XmacsLabs"); -#elif defined(OS_MACOS) - set_env ("TEXMACS_HOME_PATH", get_env ("HOME") * "/Library/Application Support/XmacsLabs"); -#elif defined(OS_HAIKU) - set_env ("TEXMACS_HOME_PATH", - get_env ("HOME") * "/config/settings/TeXmacs"); -#elif defined(OS_WASM) - set_env ("TEXMACS_HOME_PATH", "/.Xmacs"); + if (os_mingw () || os_win ()) { + set_env ("TEXMACS_HOME_PATH", get_env ("APPDATA") * "\\XmacsLabs"); + } else if (os_macos ()) { + set_env ("TEXMACS_HOME_PATH", get_env ("HOME") * "/Library/Application Support/XmacsLabs"); + } else if (os_wasm ()) { + set_env ("TEXMACS_HOME_PATH", "/.XmacsLabs"); + } else { +#if defined(OS_HAIKU) + set_env ("TEXMACS_HOME_PATH", get_env ("HOME") * "/config/settings/TeXmacs"); #else - set_env ("TEXMACS_HOME_PATH", get_env ("HOME") * "/.TeXmacs"); + string xdg_data_home= get_env ("XDG_DATA_HOME"); + if (is_empty (xdg_data_home)) + xdg_data_home= get_env ("HOME") * "/.local/share"; + set_env ("TEXMACS_HOME_PATH", xdg_data_home * "/XmacsLabs"); #endif + } }