rename if a cloned folder already exists

This commit is contained in:
Hylke Bons 2010-06-01 21:33:09 +02:00
parent aa3523c1aa
commit c787940c3c
2 changed files with 19 additions and 10 deletions

View file

@ -119,6 +119,7 @@ namespace SparkleShare {
else else
RepoName = RepoRemoteUrl.Substring (ColumnPos + 1); RepoName = RepoRemoteUrl.Substring (ColumnPos + 1);
SparkleBubble SyncingBubble = SparkleBubble SyncingBubble =
new SparkleBubble (_("Syncing folder ") + RepoName + "", new SparkleBubble (_("Syncing folder ") + RepoName + "",
_("SparkleShare will notify you ") + _("SparkleShare will notify you ") +
@ -179,12 +180,20 @@ namespace SparkleShare {
} else { } else {
Directory.Move ( string OldPath =
SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath, SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath,
RepoName), RepoName);
string NewPath =
SparkleHelpers.CombineMore (SparklePaths.SparklePath, SparkleHelpers.CombineMore (SparklePaths.SparklePath,
RepoName) RepoName);
);
if (Directory.Exists (NewPath))
NewPath += " (2)";
// Move the cloned repository from the temporary
// folder to the SparkleShare folder
Directory.Move (OldPath, NewPath);
Console.WriteLine ("[Git][" + RepoName + "] Repository cloned"); Console.WriteLine ("[Git][" + RepoName + "] Repository cloned");
@ -201,8 +210,8 @@ namespace SparkleShare {
SparkleHelpers.CombineMore ( SparkleHelpers.CombineMore (
SparklePaths.SparklePath, RepoName); SparklePaths.SparklePath, RepoName);
Process.Start (); Process.Start ();
} } );
);
FinishedBubble.Show (); FinishedBubble.Show ();
// Destroy the Add dialog // Destroy the Add dialog

View file

@ -140,7 +140,6 @@ namespace SparkleShare {
QuitItem.Activated += delegate { Environment.Exit (0); }; QuitItem.Activated += delegate { Environment.Exit (0); };
Menu.Add (QuitItem); Menu.Add (QuitItem);
Menu.ShowAll (); Menu.ShowAll ();
// TODO: Make sure the menu never overlaps the status icon
Menu.Popup (null, null, SetPosition, 0, 0); Menu.Popup (null, null, SetPosition, 0, 0);
} }
@ -200,10 +199,11 @@ namespace SparkleShare {
} }
// TODO: menu should not dissappear on mouse up // TODO: menu should not dissappear on mouse up
public void SetPosition (Menu menu, public void SetPosition
out int x, out int y, (Menu menu, out int x, out int y, out bool push_in) {
out bool push_in) {
PositionMenu (menu, out x, out y, out push_in, Handle); PositionMenu (menu, out x, out y, out push_in, Handle);
} }
// Quits the program // Quits the program