From 25bdcb17d76d0fb36a73527f210fc367a6b014e8 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 22 Nov 2012 13:55:31 +0100 Subject: under Windows, look for profile in current directory * profile is called "teco.ini" under Windows --- main.cpp | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index c70dd79..042d811 100644 --- a/main.cpp +++ b/main.cpp @@ -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); -- cgit v1.2.3