diff options
author | Berke Viktor <berkeviktor@aol.com> | 2011-08-17 15:26:08 +0200 |
---|---|---|
committer | Berke Viktor <berkeviktor@aol.com> | 2011-08-17 15:26:08 +0200 |
commit | 440e3bc279a9ef5d33a3e70d54c8d1b2dd0bde2b (patch) | |
tree | 4662beb2c8413159cd75a43d00a120926b7f35a0 /src/gtk2-prefs/main.cpp | |
parent | 5472a813fa62370926ace45d7506f098368428eb (diff) |
disable logging when not in portable mode
Diffstat (limited to 'src/gtk2-prefs/main.cpp')
-rw-r--r-- | src/gtk2-prefs/main.cpp | 11 |
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 |