controller: Move cloned folder deletion logic to fetcher
This commit is contained in:
parent
c4c933ebf7
commit
cf9424042f
|
@ -254,10 +254,8 @@ namespace SparkleLib.Git {
|
|||
return false;
|
||||
}
|
||||
|
||||
Process process = new Process () {
|
||||
EnableRaisingEvents = true
|
||||
};
|
||||
|
||||
Process process = new Process ();
|
||||
process.EnableRaisingEvents = true;
|
||||
process.StartInfo.WorkingDirectory = TargetFolder;
|
||||
process.StartInfo.UseShellExecute = false;
|
||||
process.StartInfo.RedirectStandardOutput = true;
|
||||
|
@ -267,6 +265,9 @@ namespace SparkleLib.Git {
|
|||
process.StartInfo.Arguments = "enc -d -aes-256-cbc -base64 -S " + this.crypto_salt +
|
||||
" -pass pass:\"" + password + "\" -in " + password_check_file_path;
|
||||
|
||||
SparkleLogger.LogInfo ("Cmd | " + System.IO.Path.GetFileName (process.StartInfo.WorkingDirectory),
|
||||
System.IO.Path.GetFileName (process.StartInfo.FileName) + " " + process.StartInfo.Arguments);
|
||||
|
||||
process.Start ();
|
||||
process.WaitForExit ();
|
||||
|
||||
|
@ -291,6 +292,16 @@ namespace SparkleLib.Git {
|
|||
} catch (Exception e) {
|
||||
SparkleLogger.LogInfo ("Fetcher", "Failed to dispose properly", e);
|
||||
}
|
||||
|
||||
if (Directory.Exists (TargetFolder)) {
|
||||
try {
|
||||
Directory.Delete (TargetFolder, true /* Recursive */ );
|
||||
SparkleLogger.LogInfo ("Fetcher", "Deleted '" + TargetFolder + "'");
|
||||
|
||||
} catch (Exception e) {
|
||||
SparkleLogger.LogInfo ("Fetcher", "Failed to delete '" + TargetFolder + "'", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -588,20 +588,9 @@ namespace SparkleShare {
|
|||
public void StopFetcher ()
|
||||
{
|
||||
this.fetcher.Stop ();
|
||||
|
||||
if (Directory.Exists (this.fetcher.TargetFolder)) {
|
||||
try {
|
||||
Directory.Delete (this.fetcher.TargetFolder, true /* Recursive */ );
|
||||
SparkleLogger.LogInfo ("Controller", "Deleted '" + this.fetcher.TargetFolder + "'");
|
||||
|
||||
} catch (Exception e) {
|
||||
SparkleLogger.LogInfo ("Controller", "Failed to delete '" + this.fetcher.TargetFolder + "'", e);
|
||||
}
|
||||
}
|
||||
|
||||
this.fetcher.Dispose ();
|
||||
this.fetcher = null;
|
||||
|
||||
this.fetcher = null;
|
||||
this.watcher.EnableRaisingEvents = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue