[gitg/gnome-3-20] Create global config file if it doesn't exist yet
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/gnome-3-20] Create global config file if it doesn't exist yet
- Date: Thu, 25 Aug 2016 14:53:59 +0000 (UTC)
commit a7d40eb5f0837ea425c9f4bdbdeb85beb00674ef
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Wed Aug 17 20:01:34 2016 +0200
Create global config file if it doesn't exist yet
https://bugzilla.gnome.org/show_bug.cgi?id=760119
gitg/gitg-author-details-dialog.vala | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gitg/gitg-author-details-dialog.vala b/gitg/gitg-author-details-dialog.vala
index acb2c78..c2d8640 100644
--- a/gitg/gitg-author-details-dialog.vala
+++ b/gitg/gitg-author-details-dialog.vala
@@ -56,6 +56,18 @@ namespace Gitg
public static AuthorDetailsDialog? show_global(Window window)
{
+ var xdg_config_path = Path.build_filename(Environment.get_user_config_dir(), "git",
"config");
+ var config_path = Path.build_filename(Environment.get_home_dir(), ".gitconfig");
+
+ // If neither exists yet, create default empty one
+ if (!FileUtils.test(xdg_config_path, FileTest.EXISTS) && !FileUtils.test(config_path,
FileTest.EXISTS))
+ {
+ try
+ {
+ FileUtils.set_contents(config_path, "");
+ } catch {}
+ }
+
var global_config_file = Ggit.Config.find_global();
if (global_config_file == null)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]