controller: try moving projects from .tmp twice and add more debug output

This commit is contained in:
Hylke Bons 2012-11-19 12:16:57 +00:00
parent cdf28e8d20
commit aae2433741
2 changed files with 14 additions and 7 deletions

View file

@ -455,7 +455,7 @@ namespace SparkleShare {
}
private void ClearFolderAttributes (string path)
private void ClearDirectoryAttributes (string path)
{
if (!Directory.Exists (path))
return;
@ -463,7 +463,7 @@ namespace SparkleShare {
string [] folders = Directory.GetDirectories (path);
foreach (string folder in folders)
ClearFolderAttributes (folder);
ClearDirectoryAttributes (folder);
string [] files = Directory.GetFiles(path);
@ -652,13 +652,20 @@ namespace SparkleShare {
string target_folder_path = Path.Combine (this.config.FoldersPath, target_folder_name);
try {
ClearFolderAttributes (this.fetcher.TargetFolder);
Directory.Move (this.fetcher.TargetFolder, target_folder_path);
} catch (Exception e) {
SparkleLogger.LogInfo ("Controller", "Error moving directory: " + e.Message);
this.watcher.EnableRaisingEvents = true;
return;
SparkleLogger.LogInfo ("Controller", "Error moving directory: \"" + e.Message + "\", trying again...");
try {
ClearDirectoryAttributes (this.fetcher.TargetFolder);
Directory.Move (this.fetcher.TargetFolder, target_folder_path);
} catch (Exception x) {
SparkleLogger.LogInfo ("Controller", "Error moving directory: " + x.Message);
this.watcher.EnableRaisingEvents = true;
return;
}
}
string backend = SparkleFetcherBase.GetBackend (this.fetcher.RemoteUrl.AbsolutePath);

View file

@ -241,7 +241,7 @@ namespace SparkleShare {
Program.Controller.OpenWebsite (url);
} else if (url.StartsWith ("restore://") && this.restore_revision_info == null) {
Regex regex = new Regex ("restore://(.+)/([a-f0-9]+)/(.+)/(.{3} [0-9]+ [0-9]+h[0-9]+)/(.+)", RegexOptions.Compiled);
Regex regex = new Regex ("restore://(.+)/([a-f0-9]+)/(.+)/(.{3} [0-9]+ [0-9]+h[0-9]+)/(.+)");
Match match = regex.Match (url);
if (match.Success) {