From 440e3bc279a9ef5d33a3e70d54c8d1b2dd0bde2b Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Wed, 17 Aug 2011 15:26:08 +0200 Subject: disable logging when not in portable mode --- src/gtk2-prefs/main.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/gtk2-prefs') diff --git a/src/gtk2-prefs/main.cpp b/src/gtk2-prefs/main.cpp index e1a0415d..42e425c2 100644 --- a/src/gtk2-prefs/main.cpp +++ b/src/gtk2-prefs/main.cpp @@ -288,10 +288,15 @@ static void populate_with_themes(GtkWidget* w) static void redirect_to_file (const gchar* log_domain, GLogLevelFlags log_level, const gchar* message, gpointer user_data) { - std::fstream f; - f.open("g_stdout.txt", std::ios::app); + /* only write logs if running in portable mode, otherwise + we would get a permission error in program files */ + if ((_access( "portable-mode", 0 )) != -1) + { + std::fstream f; + f.open("gtk2-prefs.log", std::ios::app); f << message << "\n"; - f.close(); + f.close(); + } } #endif -- cgit 1.4.1