diff options
author | Alessandro Ghedini <al3xbio@gmail.com> | 2012-03-05 12:19:59 +0100 |
---|---|---|
committer | Alessandro Ghedini <al3xbio@gmail.com> | 2012-03-05 12:19:59 +0100 |
commit | 98f3ef2689de06e8ab8b46a91acfa7dd2056a3a6 (patch) | |
tree | b98e438ac1082925e12af6dfec6d9ebeb4e3035e /src/utilities/paths.vala | |
parent | a824c3e5bdab686901b02667609282e7d596a6af (diff) |
Imported Upstream version 0.5.1
Diffstat (limited to 'src/utilities/paths.vala')
-rw-r--r-- | src/utilities/paths.vala | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/src/utilities/paths.vala b/src/utilities/paths.vala index 589cc36..bc3e9b1 100644 --- a/src/utilities/paths.vala +++ b/src/utilities/paths.vala @@ -23,16 +23,30 @@ namespace GnomePie { ///////////////////////////////////////////////////////////////////////// public class Paths : GLib.Object { + + ///////////////////////////////////////////////////////////////////// + /// The log file, + /// usually ~/.config/gnome-pie/gnome-pie.log. + ///////////////////////////////////////////////////////////////////// + + public static string log { get; private set; default=""; } + + ///////////////////////////////////////////////////////////////////// + /// The statistics file, + /// usually ~/.config/gnome-pie/gnome-pie.stats. + ///////////////////////////////////////////////////////////////////// + + public static string stats { get; private set; default=""; } ///////////////////////////////////////////////////////////////////// - /// The file settings file, + /// The settings file, /// usually ~/.config/gnome-pie/gnome-pie.conf. ///////////////////////////////////////////////////////////////////// public static string settings { get; private set; default=""; } ///////////////////////////////////////////////////////////////////// - /// The file pie configuration file + /// The pie configuration file /// usually ~/.config/gnome-pie/pies.conf. ///////////////////////////////////////////////////////////////////// @@ -186,6 +200,24 @@ public class Paths : GLib.Object { pie_config = config_file.get_path(); settings = config_dir.get_path() + "/gnome-pie.conf"; + log = config_dir.get_path() + "/gnome-pie.log"; + stats = config_dir.get_path() + "/gnome-pie.stats"; + + if (!GLib.File.new_for_path(log).query_exists()) { + try { + FileUtils.set_contents(log, ""); + } catch (GLib.FileError e) { + error(e.message); + } + } + + if (!GLib.File.new_for_path(stats).query_exists()) { + try { + FileUtils.set_contents(stats, ""); + } catch (GLib.FileError e) { + error(e.message); + } + } // autostart file name autostart = GLib.Path.build_filename(GLib.Environment.get_user_config_dir(), @@ -196,7 +228,13 @@ public class Paths : GLib.Object { warning("Failed to find pie configuration file \"pies.conf\"! (This should only happen when Gnome-Pie is started for the first time...)"); if (!GLib.File.new_for_path(settings).query_exists()) - warning("Failed to find settings file \"gnome-pie.conf\"!"); + warning("Failed to find settings file \"gnome-pie.conf\"! (This should only happen when Gnome-Pie is started for the first time...)"); + + if (!GLib.File.new_for_path(log).query_exists()) + warning("Failed to find log file \"gnome-pie.log\"!"); + + if (!GLib.File.new_for_path(stats).query_exists()) + warning("Failed to find statistics file \"gnome-pie.stats\"!"); if (!GLib.File.new_for_path(local_themes).query_exists()) warning("Failed to find local themes directory!"); |