Allow using periods '.' and underscores '_' (will be replaced by spaces locally) in project names. fixes #1046
This commit is contained in:
parent
c647a9202d
commit
66b37c2270
|
@ -339,16 +339,14 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static string GetBackend (string path)
|
public static string GetBackend (string address)
|
||||||
{
|
{
|
||||||
string extension = Path.GetExtension (path);
|
Uri uri = new Uri (address);
|
||||||
|
int index_of_plus = uri.Scheme.IndexOf ("+");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty (extension)) {
|
if (index_of_plus > -1) {
|
||||||
extension = extension.Substring (1);
|
string backend = uri.Scheme.Substring (index_of_plus + 1);
|
||||||
char [] letters = extension.ToCharArray ();
|
return char.ToUpper (backend [0]) + backend.Substring (1);
|
||||||
letters [0] = char.ToUpper (letters [0]);
|
|
||||||
|
|
||||||
return new string (letters);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return "Git";
|
return "Git";
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
</info>
|
</info>
|
||||||
<address>
|
<address>
|
||||||
<value/>
|
<value/>
|
||||||
<example>[user@]hostname[:port]</example>
|
<example>ssh://[user@]hostname[:port]</example>
|
||||||
</address>
|
</address>
|
||||||
<path>
|
<path>
|
||||||
<value/>
|
<value/>
|
||||||
|
|
|
@ -523,9 +523,12 @@ namespace SparkleShare {
|
||||||
File.SetAttributes (tmp_path, File.GetAttributes (tmp_path) | FileAttributes.Hidden);
|
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 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 {
|
try {
|
||||||
this.fetcher = (SparkleFetcherBase) Activator.CreateInstance (
|
this.fetcher = (SparkleFetcherBase) Activator.CreateInstance (
|
||||||
|
@ -603,7 +606,7 @@ namespace SparkleShare {
|
||||||
this.watcher.EnableRaisingEvents = false;
|
this.watcher.EnableRaisingEvents = false;
|
||||||
|
|
||||||
this.fetcher.Complete ();
|
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 ("-crypto", "");
|
||||||
canonical_name = canonical_name.Replace ("_", " ");
|
canonical_name = canonical_name.Replace ("_", " ");
|
||||||
|
|
|
@ -136,7 +136,8 @@ namespace SparkleShare {
|
||||||
Plugins.Insert (0, new SparklePlugin (xml_file_path));
|
Plugins.Insert (0, new SparklePlugin (xml_file_path));
|
||||||
|
|
||||||
} else if (xml_file_path.EndsWith ("ssnet.xml")) {
|
} 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 {
|
} else {
|
||||||
Plugins.Add (new SparklePlugin (xml_file_path));
|
Plugins.Add (new SparklePlugin (xml_file_path));
|
||||||
|
@ -341,7 +342,11 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public void AddPageCompleted (string address, string remote_path)
|
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", "");
|
SyncingFolder = SyncingFolder.Replace ("-crypto", "");
|
||||||
ProgressBarPercentage = 1.0;
|
ProgressBarPercentage = 1.0;
|
||||||
|
|
||||||
|
@ -424,7 +429,12 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public void InvitePageCompleted ()
|
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;
|
PreviousAddress = PendingInvite.Address;
|
||||||
PreviousPath = PendingInvite.RemotePath;
|
PreviousPath = PendingInvite.RemotePath;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue