Exception handled when old .tmp files read-only

When fetching a repository with the same name as an old repo, the .tmp
folder may have read-only files left in it which it cannot delete. This
change provides a message to the user about it. It may be possible to
further extend this to make such files writable, but leaving it up to
the user may be the safest option.
This commit is contained in:
foxox 2014-01-28 11:31:46 -05:00 committed by Hylke Bons
parent 5c0e9d7e67
commit f5b3680c38

View file

@ -139,8 +139,15 @@ namespace SparkleLib {
SparkleLogger.LogInfo ("Fetcher", TargetFolder + " | Fetching folder: " + RemoteUrl);
if (Directory.Exists (TargetFolder))
Directory.Delete (TargetFolder, true);
try {
if (Directory.Exists (TargetFolder))
Directory.Delete (TargetFolder, true);
} catch (IOException) {
this.errors.Add ("\"" + TargetFolder + "\" is read-only.");
Failed ();
return;
}
this.thread = new Thread (() => {
if (Fetch ()) {