Skip to content

Commit

Permalink
Fixing an serious flaw with cold FileUpdateTask operation
Browse files Browse the repository at this point in the history
  • Loading branch information
synhershko committed Jul 10, 2012
1 parent 3a905df commit 6e9ef31
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/NAppUpdate.Framework/Tasks/FileUpdateTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public override bool Prepare(Sources.IUpdateSource source)
return false;
}

destinationFile = Path.Combine(Path.GetDirectoryName(UpdateManager.Instance.ApplicationPath), LocalPath);

return tempFile != null;
}

Expand All @@ -69,9 +71,9 @@ public override TaskExecutionStatus Execute(bool coldRun)
if (string.IsNullOrEmpty(LocalPath))
return TaskExecutionStatus.Successful;

destinationFile = Path.Combine(Path.GetDirectoryName(UpdateManager.Instance.ApplicationPath), LocalPath);
if (!Directory.Exists(Path.GetDirectoryName(destinationFile)))
Utils.FileSystem.CreateDirectoryStructure(Path.GetDirectoryName(destinationFile), false);
var dirName = Path.GetDirectoryName(destinationFile);
if (!Directory.Exists(dirName))
Utils.FileSystem.CreateDirectoryStructure(dirName, false);

// Create a backup copy if target exists
if (backupFile == null && File.Exists(destinationFile))
Expand Down

0 comments on commit 6e9ef31

Please sign in to comment.