summary refs log tree commit diff stats
path: root/src/gtk2-prefs/main.cpp
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2011-08-17 15:26:08 +0200
committerBerke Viktor <berkeviktor@aol.com>2011-08-17 15:26:08 +0200
commit440e3bc279a9ef5d33a3e70d54c8d1b2dd0bde2b (patch)
tree4662beb2c8413159cd75a43d00a120926b7f35a0 /src/gtk2-prefs/main.cpp
parent5472a813fa62370926ace45d7506f098368428eb (diff)
disable logging when not in portable mode
Diffstat (limited to 'src/gtk2-prefs/main.cpp')
-rw-r--r--src/gtk2-prefs/main.cpp11
1 files changed, 8 insertions, 3 deletions
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