From 4ee5187c84fd12deb0cdc116e7101a34b31d21de Mon Sep 17 00:00:00 2001 From: Brandon Dahler Date: Sat, 5 Jan 2013 02:38:01 -0600 Subject: [PATCH] Update from using AbsolutePath to LocalPath for all uris, fix some uri path combining. --- SparkleLib/Git/SparkleFetcherGit.cs | 14 +++++++------- SparkleLib/SparkleFetcherBase.cs | 4 ++-- SparkleShare/SparkleControllerBase.cs | 4 ++-- SparkleShare/SparkleSetupController.cs | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/SparkleLib/Git/SparkleFetcherGit.cs b/SparkleLib/Git/SparkleFetcherGit.cs index c1c7e92e..1e3c623d 100755 --- a/SparkleLib/Git/SparkleFetcherGit.cs +++ b/SparkleLib/Git/SparkleFetcherGit.cs @@ -75,17 +75,17 @@ namespace SparkleLib.Git { } if (uri.Host.Equals ("gitorious.org") && !uri.Scheme.StartsWith ("http")) { - if (!uri.AbsolutePath.Equals ("/") && - !uri.AbsolutePath.EndsWith (".git")) { + if (!uri.LocalPath.Equals ("/") && + !uri.LocalPath.EndsWith (".git")) { - uri = new Uri ("ssh://git@gitorious.org" + uri.AbsolutePath + ".git"); + uri = new Uri (Path.Combine( "ssh://git@gitorious.org", uri.LocalPath, ".git")); } else { - uri = new Uri ("ssh://git@gitorious.org" + uri.AbsolutePath); + uri = new Uri (Path.Combine ("ssh://git@gitorious.org", uri.LocalPath)); } } else if (uri.Host.Equals ("github.com") && !uri.Scheme.StartsWith ("http")) { - uri = new Uri ("ssh://git@github.com" + uri.AbsolutePath); + uri = new Uri (Path.Combine("ssh://git@github.com", uri.LocalPath)); } else if (uri.Host.Equals ("bitbucket.org") && !uri.Scheme.StartsWith ("http")) { // Nothing really @@ -93,9 +93,9 @@ namespace SparkleLib.Git { } else { if (string.IsNullOrEmpty (uri.UserInfo) && !uri.Scheme.StartsWith ("http")) { if (uri.Port == -1) - uri = new Uri (uri.Scheme + "://storage@" + uri.Host + uri.AbsolutePath); + uri = new Uri (Path.Combine (uri.Scheme + "://storage@" + uri.Host, uri.LocalPath)); else - uri = new Uri (uri.Scheme + "://storage@" + uri.Host + ":" + uri.Port + uri.AbsolutePath); + uri = new Uri (Path.Combine (uri.Scheme + "://storage@" + uri.Host + ":" + uri.Port, uri.LocalPath)); } this.use_git_bin = false; // TODO diff --git a/SparkleLib/SparkleFetcherBase.cs b/SparkleLib/SparkleFetcherBase.cs index 3f08c3ba..9691b3a5 100755 --- a/SparkleLib/SparkleFetcherBase.cs +++ b/SparkleLib/SparkleFetcherBase.cs @@ -164,7 +164,7 @@ namespace SparkleLib { IsActive = false; - bool repo_is_encrypted = (RemoteUrl.AbsolutePath.Contains ("-crypto") || + bool repo_is_encrypted = (RemoteUrl.LocalPath.Contains ("-crypto") || RemoteUrl.Host.Equals ("sparkleshare.net")); Finished (repo_is_encrypted, IsFetchedRepoEmpty, Warnings); @@ -224,7 +224,7 @@ namespace SparkleLib { n + "Have fun! :)" + n; - if (RemoteUrl.AbsolutePath.Contains ("-crypto") || RemoteUrl.Host.Equals ("sparkleshare.net")) + if (RemoteUrl.LocalPath.Contains ("-crypto") || RemoteUrl.Host.Equals ("sparkleshare.net")) text = text.Replace ("a SparkleShare repository", "an encrypted SparkleShare repository"); File.WriteAllText (file_path, text); diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 552543b6..68e8ff25 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -635,7 +635,7 @@ namespace SparkleShare { this.watcher.EnableRaisingEvents = false; this.fetcher.Complete (); - string canonical_name = Path.GetFileName (this.fetcher.RemoteUrl.AbsolutePath); + string canonical_name = Path.GetFileName (this.fetcher.RemoteUrl.LocalPath); canonical_name = canonical_name.Replace ("-crypto", ""); canonical_name = canonical_name.Replace ("_", " "); @@ -676,7 +676,7 @@ namespace SparkleShare { } } - string backend = SparkleFetcherBase.GetBackend (this.fetcher.RemoteUrl.AbsolutePath); + string backend = SparkleFetcherBase.GetBackend (this.fetcher.RemoteUrl.LocalPath); this.config.AddFolder (target_folder_name, this.fetcher.Identifier, this.fetcher.RemoteUrl.ToString (), backend); diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index 9c77ffe1..611f2185 100755 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -392,7 +392,7 @@ namespace SparkleShare { Uri uri = new Uri (remote_url); try { - string address = remote_url.Replace (uri.AbsolutePath, ""); + string address = uri.ToString ().Replace (uri.LocalPath, ""); new_plugin = SparklePlugin.Create (uri.Host, address, address, "", "", "/path/to/project");