diff --git a/SparkleShare/Makefile.am b/SparkleShare/Makefile.am index 15dee260..aadd1814 100644 --- a/SparkleShare/Makefile.am +++ b/SparkleShare/Makefile.am @@ -20,6 +20,7 @@ SOURCES = \ SparkleEntry.cs \ SparkleEventLog.cs \ SparkleEventLogController.cs \ + SparkleExtensions.cs \ SparkleLinController.cs \ SparkleSetup.cs \ SparkleSetupController.cs \ diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 30ed8503..423e9179 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -246,7 +246,7 @@ namespace SparkleShare { if (name == null) return GetLog (); - string path = Path.Combine (new string [] {SparkleConfig.DefaultConfig.FoldersPath, name}); + string path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, name}.Combine (); int log_size = 50; foreach (SparkleRepoBase repo in Repositories) { @@ -350,9 +350,8 @@ namespace SparkleShare { } else { if (change_set.Edited.Count > 0) { foreach (string file_path in change_set.Edited) { - string absolute_file_path = Path.Combine ( - new string [] {SparkleConfig.DefaultConfig.FoldersPath, - change_set.Folder, file_path}); + string absolute_file_path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, + change_set.Folder, file_path}.Combine (); if (File.Exists (absolute_file_path)) event_entry += "
" + file_path + "
"; @@ -363,9 +362,8 @@ namespace SparkleShare { if (change_set.Added.Count > 0) { foreach (string file_path in change_set.Added) { - string absolute_file_path = Path.Combine ( - new string [] {SparkleConfig.DefaultConfig.FoldersPath, - change_set.Folder, file_path}); + string absolute_file_path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, + change_set.Folder, file_path}.Combine (); if (File.Exists (absolute_file_path)) event_entry += "
" + file_path + "
"; @@ -376,9 +374,8 @@ namespace SparkleShare { if (change_set.Deleted.Count > 0) { foreach (string file_path in change_set.Deleted) { - string absolute_file_path = Path.Combine ( - new string [] {SparkleConfig.DefaultConfig.FoldersPath, - change_set.Folder, file_path}); + string absolute_file_path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, + change_set.Folder, file_path}.Combine (); if (File.Exists (absolute_file_path)) event_entry += "
" + file_path + "
"; @@ -392,13 +389,11 @@ namespace SparkleShare { foreach (string file_path in change_set.MovedFrom) { string to_file_path = change_set.MovedTo [i]; - string absolute_file_path = Path.Combine ( - new string [] {SparkleConfig.DefaultConfig.FoldersPath, - change_set.Folder, file_path}); + string absolute_file_path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, + change_set.Folder, file_path}.Combine (); - string absolute_to_file_path = Path.Combine ( - new string [] {SparkleConfig.DefaultConfig.FoldersPath, - change_set.Folder, file_path}); + string absolute_to_file_path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, + change_set.Folder, to_file_path}.Combine (); if (File.Exists (absolute_file_path)) event_entry += "
" + file_path + "
"; @@ -901,9 +896,9 @@ namespace SparkleShare { { List old_avatars = new List (); bool avatar_fetched = false; - string avatar_path = Path.Combine ( - new string [] {Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath), "icons", - size + "x" + size, "status"}); + string avatar_path = new string [] { + Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath), + "icons", size + "x" + size, "status"}.Combine (); if (!Directory.Exists (avatar_path)) { Directory.CreateDirectory (avatar_path); diff --git a/SparkleShare/SparkleExtensions.cs b/SparkleShare/SparkleExtensions.cs new file mode 100644 index 00000000..348835b9 --- /dev/null +++ b/SparkleShare/SparkleExtensions.cs @@ -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 SparkleShare { + + 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; + } + } +} diff --git a/SparkleShare/SparkleShare.csproj b/SparkleShare/SparkleShare.csproj index 079ec8de..373cce83 100644 --- a/SparkleShare/SparkleShare.csproj +++ b/SparkleShare/SparkleShare.csproj @@ -77,5 +77,6 @@ +