Allow using periods '.' and underscores '_' (will be replaced by spaces locally) in project names. fixes #1046

This commit is contained in:
Hylke Bons 2012-11-04 16:27:39 +00:00
parent c647a9202d
commit 66b37c2270
4 changed files with 28 additions and 17 deletions

View file

@ -339,17 +339,15 @@ namespace SparkleLib {
}
public static string GetBackend (string path)
public static string GetBackend (string address)
{
string extension = Path.GetExtension (path);
if (!string.IsNullOrEmpty (extension)) {
extension = extension.Substring (1);
char [] letters = extension.ToCharArray ();
letters [0] = char.ToUpper (letters [0]);
return new string (letters);
Uri uri = new Uri (address);
int index_of_plus = uri.Scheme.IndexOf ("+");
if (index_of_plus > -1) {
string backend = uri.Scheme.Substring (index_of_plus + 1);
return char.ToUpper (backend [0]) + backend.Substring (1);
} else {
return "Git";
}

View file

@ -9,7 +9,7 @@
</info>
<address>
<value/>
<example>[user@]hostname[:port]</example>
<example>ssh://[user@]hostname[:port]</example>
</address>
<path>
<value/>

View file

@ -523,9 +523,12 @@ namespace SparkleShare {
File.SetAttributes (tmp_path, File.GetAttributes (tmp_path) | FileAttributes.Hidden);
}
string canonical_name = Path.GetFileNameWithoutExtension (remote_path);
string canonical_name = Path.GetFileName (remote_path);
string tmp_folder = Path.Combine (tmp_path, canonical_name);
string backend = SparkleFetcherBase.GetBackend (remote_path);
string backend = SparkleFetcherBase.GetBackend (address);
if (address.StartsWith ("ssh+"))
address = "ssh" + address.Substring (address.IndexOf ("://"));
try {
this.fetcher = (SparkleFetcherBase) Activator.CreateInstance (
@ -603,7 +606,7 @@ namespace SparkleShare {
this.watcher.EnableRaisingEvents = false;
this.fetcher.Complete ();
string canonical_name = Path.GetFileNameWithoutExtension (this.fetcher.RemoteUrl.AbsolutePath);
string canonical_name = Path.GetFileName (this.fetcher.RemoteUrl.AbsolutePath);
canonical_name = canonical_name.Replace ("-crypto", "");
canonical_name = canonical_name.Replace ("_", " ");

View file

@ -136,7 +136,8 @@ namespace SparkleShare {
Plugins.Insert (0, new SparklePlugin (xml_file_path));
} else if (xml_file_path.EndsWith ("ssnet.xml")) {
// Plugins.Insert ((local_plugins_count + 1), new SparklePlugin (xml_file_path)); TODO: Skip this plugin for now
// Plugins.Insert ((local_plugins_count + 1), new SparklePlugin (xml_file_path));
// TODO: Skip this plugin for now
} else {
Plugins.Add (new SparklePlugin (xml_file_path));
@ -341,7 +342,11 @@ namespace SparkleShare {
public void AddPageCompleted (string address, string remote_path)
{
SyncingFolder = Path.GetFileNameWithoutExtension (remote_path);
SyncingFolder = Path.GetFileName (remote_path);
if (remote_path.EndsWith (".git"))
SyncingFolder = remote_path.Substring (0, remote_path.Length - 4);
SyncingFolder = SyncingFolder.Replace ("-crypto", "");
ProgressBarPercentage = 1.0;
@ -424,7 +429,12 @@ namespace SparkleShare {
public void InvitePageCompleted ()
{
SyncingFolder = Path.GetFileNameWithoutExtension (PendingInvite.RemotePath);
SyncingFolder = Path.GetFileName (PendingInvite.RemotePath);
if (PendingInvite.RemotePath.EndsWith (".git"))
SyncingFolder = PendingInvite.RemotePath.Substring (0, PendingInvite.RemotePath.Length - 4);
SyncingFolder = SyncingFolder.Replace ("-crypto", "");
PreviousAddress = PendingInvite.Address;
PreviousPath = PendingInvite.RemotePath;