repo git: Create size store files when they don't exist yet

This commit is contained in:
Hylke Bons 2018-05-11 08:21:27 +01:00
parent f9c60cbd39
commit 4e0dff6956

View file

@ -98,8 +98,12 @@ namespace Sparkles.Git {
get {
string file_path = Path.Combine (LocalPath, ".git", "info", "size");
if (!File.Exists (file_path))
File.WriteAllText (file_path, "0");
string size = File.ReadAllText (file_path);
try {
string size = File.ReadAllText (file_path);
return double.Parse (size);
} catch (Exception e) {
@ -114,8 +118,12 @@ namespace Sparkles.Git {
get {
string file_path = Path.Combine (LocalPath, ".git", "info", "history_size");
if (!File.Exists (file_path))
File.WriteAllText (file_path, "0");
string size = File.ReadAllText (file_path);
try {
string size = File.ReadAllText (file_path);
return double.Parse (size);
} catch (Exception e) {