Update from using AbsolutePath to LocalPath for all uris, fix some uri path combining.

This commit is contained in:
Brandon Dahler 2013-01-05 02:38:01 -06:00
parent bbd322a7d0
commit b2b49012c1
4 changed files with 12 additions and 12 deletions

View file

@ -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

View file

@ -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);

View file

@ -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);

View file

@ -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");