diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-22 13:55:31 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-22 13:55:31 +0100 |
commit | 25bdcb17d76d0fb36a73527f210fc367a6b014e8 (patch) | |
tree | 80e0a0c85723847134526ccb55fd899e62eb6a74 | |
parent | 32d9c760b3ad78e6a62c2144647aac0a220c06fb (diff) | |
download | sciteco-25bdcb17d76d0fb36a73527f210fc367a6b014e8.tar.gz |
under Windows, look for profile in current directory
* profile is called "teco.ini" under Windows
-rw-r--r-- | main.cpp | 42 |
1 files changed, 34 insertions, 8 deletions
@@ -17,7 +17,11 @@ #include "qbuffers.h" #include "undo.h" +#ifdef G_OS_UNIX #define INI_FILE ".teco_ini" +#else +#define INI_FILE "teco.ini" +#endif namespace Flags { gint64 ed = 0; @@ -56,6 +60,35 @@ Interface::process_notify(SCNotification *notify) #endif } +#ifdef G_OS_WIN32 + +/* + * keep program self-contained under Windows + * (look for profile in current directory) + */ +static inline gchar * +get_teco_ini(void) +{ + return g_strdup(INI_FILE); +} + +#else + +static inline gchar * +get_teco_ini(void) +{ + const gchar *home; + +#ifdef G_OS_UNIX + home = g_get_home_dir(); +#else + home = g_get_user_config_dir(); +#endif + return g_build_filename(home, INI_FILE, NULL); +} + +#endif /* !G_OS_WIN32 */ + static inline void process_options(int &argc, char **&argv) { @@ -88,14 +121,7 @@ process_options(int &argc, char **&argv) exit(EXIT_FAILURE); } } else { - const gchar *home; - -#ifdef G_OS_UNIX - home = g_get_home_dir(); -#else - home = g_get_user_config_dir(); -#endif - mung_file = g_build_filename(home, INI_FILE, NULL); + mung_file = get_teco_ini(); } interface.parse_args(argc, argv); |