Fixing #298 again first try
This commit is contained in:
parent
5ef5107b62
commit
a37a041018
|
@ -71,7 +71,7 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public override double Size {
|
public override double Size {
|
||||||
get {
|
get {
|
||||||
string file_path = Path.Combine (LocalPath, ".git", "repo_size");
|
string file_path = new string [] {LocalPath, ".git", "repo_size"}.Combine();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return double.Parse (File.ReadAllText (file_path));
|
return double.Parse (File.ReadAllText (file_path));
|
||||||
|
@ -85,7 +85,7 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public override double HistorySize {
|
public override double HistorySize {
|
||||||
get {
|
get {
|
||||||
string file_path = Path.Combine (LocalPath, ".git", "repo_history_size");
|
string file_path = new string [] {LocalPath, ".git", "repo_history_size"}.Combine();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return double.Parse (File.ReadAllText (file_path));
|
return double.Parse (File.ReadAllText (file_path));
|
||||||
|
@ -103,10 +103,10 @@ namespace SparkleLib {
|
||||||
new DirectoryInfo (LocalPath));
|
new DirectoryInfo (LocalPath));
|
||||||
|
|
||||||
double history_size = CalculateSize (
|
double history_size = CalculateSize (
|
||||||
new DirectoryInfo (Path.Combine (LocalPath, ".git")));
|
new DirectoryInfo (new string [] {LocalPath, ".git"}.Combine() ));
|
||||||
|
|
||||||
string size_file_path = Path.Combine (LocalPath, ".git", "repo_size");
|
string size_file_path = new string [] {LocalPath, ".git", "repo_size"}.Combine();
|
||||||
string history_size_file_path = Path.Combine (LocalPath, ".git", "repo_history_size");
|
string history_size_file_path = new string [] {LocalPath, ".git", "repo_history_size"}.Combine();
|
||||||
|
|
||||||
File.WriteAllText (size_file_path, size.ToString ());
|
File.WriteAllText (size_file_path, size.ToString ());
|
||||||
File.WriteAllText (history_size_file_path, history_size.ToString ());
|
File.WriteAllText (history_size_file_path, history_size.ToString ());
|
||||||
|
|
|
@ -3,6 +3,7 @@ TARGET = library
|
||||||
|
|
||||||
SOURCES = \
|
SOURCES = \
|
||||||
Defines.cs \
|
Defines.cs \
|
||||||
|
SparkleExtensions.cs \
|
||||||
Git/SparkleFetcherGit.cs \
|
Git/SparkleFetcherGit.cs \
|
||||||
Git/SparkleGit.cs \
|
Git/SparkleGit.cs \
|
||||||
Git/SparkleRepoGit.cs \
|
Git/SparkleRepoGit.cs \
|
||||||
|
|
35
SparkleLib/SparkleExtensions.cs
Executable file
35
SparkleLib/SparkleExtensions.cs
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
// SparkleShare, a collaboration and sharing tool.
|
||||||
|
// Copyright (C) 2010 Hylke Bons (hylkebons@gmail.com)
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see (http://www.gnu.org/licenses/).
|
||||||
|
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace SparkleLib {
|
||||||
|
|
||||||
|
public static class Extensions {
|
||||||
|
|
||||||
|
public static string Combine (this String [] parts)
|
||||||
|
{
|
||||||
|
string new_path = "";
|
||||||
|
|
||||||
|
foreach (string part in parts)
|
||||||
|
new_path = Path.Combine (new_path, part);
|
||||||
|
|
||||||
|
return new_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -49,6 +49,7 @@
|
||||||
<Compile Include="SparkleBackend.cs" />
|
<Compile Include="SparkleBackend.cs" />
|
||||||
<Compile Include="SparkleConfig.cs" />
|
<Compile Include="SparkleConfig.cs" />
|
||||||
<Compile Include="SparkleWatcher.cs" />
|
<Compile Include="SparkleWatcher.cs" />
|
||||||
|
<Compile Include="SparkleExtensions.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
|
|
Loading…
Reference in a new issue