# HG changeset patch # User Markus Mützel # Date 1656757816 -7200 # Sat Jul 02 12:30:16 2022 +0200 # Node ID 214b48b5f20be6121ccf79ae19182d408a8dfa37 # Parent bc62d4ad2aae6dead3d5f06854cafa632a66fcc6 Use platform specific fallback for XDG_CONFIG_HOME and XDG_DATA_HOME on OS X (bug #62515). * liboctave/system/oct-env.cc (do_get_user_config_directory, do_get_user_data_directory): If XDG_CONFIG_HOME or XDG_DATA_HOME aren't set, use platform specific fallback on OS X. * libinterp/corefcn/oct-hist.cc (Fhistory_file): Adapt documentation for changed fallback. diff -r bc62d4ad2aae -r 214b48b5f20b libinterp/corefcn/oct-hist.cc --- a/libinterp/corefcn/oct-hist.cc Wed Jun 29 19:07:59 2022 +0200 +++ b/libinterp/corefcn/oct-hist.cc Sat Jul 02 12:30:16 2022 +0200 @@ -819,7 +819,8 @@ The default value is @file{@w{@env{$DATA}}/octave/history}, where @w{@env{$DATA}} is the platform-specific location for (roaming) user data files -(e.g., @w{@env{$XDG_DATA_HOME}} or, if that is not set, @file{~/.local/share} on +(e.g., @w{@env{$XDG_DATA_HOME}} or, if that is not set, +@{~/Library/Application Support} on OS X, @file{~/.local/share} on other Unix-like operating systems or @w{@env{%APPDATA%}} on Windows). The default value may be overridden by the environment variable @w{@env{OCTAVE_HISTFILE}}. diff -r bc62d4ad2aae -r 214b48b5f20b liboctave/system/oct-env.cc --- a/liboctave/system/oct-env.cc Wed Jun 29 19:07:59 2022 +0200 +++ b/liboctave/system/oct-env.cc Sat Jul 02 12:30:16 2022 +0200 @@ -260,8 +260,14 @@ #endif if (cfg_dir.empty ()) +#if defined(__APPLE__) + cfg_dir = do_get_home_directory () + sys::file_ops::dir_sep_str () + + "Library" + sys::file_ops::dir_sep_str () + + "Application Support"; +#else cfg_dir = do_get_home_directory () + sys::file_ops::dir_sep_str () + ".config"; +#endif return cfg_dir; } @@ -281,8 +287,14 @@ #endif if (data_dir.empty ()) +#if defined(__APPLE__) + data_dir = do_get_home_directory () + sys::file_ops::dir_sep_str () + + "Library" + sys::file_ops::dir_sep_str () + + "Application Support"; +#else data_dir = do_get_home_directory () + sys::file_ops::dir_sep_str () + ".local" + sys::file_ops::dir_sep_str () + "share"; +#else return data_dir; }