Hi,
we're using your framework and stumbled upon the problem where File.Exists(localPath);
from *Condition
classes returns false because our app was not started manually (by clicking on an exe) but through registry upon machine startup.
After some debugging we found out that the problem was System.IO.File
would look at a different default folder based on the two different ways of starting the app. If the app is started manually it properly looks into its root and updates the changed files. If however the app is started automatically on startup, the default directory that System.IO.File
uses is for some reason C:\Windows\SysWOW64.
This caused us some problems so we temporarily fixed NAppUpdate by adding these few lines:
var appDirectory = Path.GetDirectoryName(UpdateManager.Instance.ApplicationPath);
if (!localPath.StartsWith(appDirectory, StringComparison.InvariantCultureIgnoreCase))
{
localPath = Path.Combine(appDirectory, localPath);
}
after:
if (string.IsNullOrEmpty(localPath))
return true;
in the following classes:
- FileChecksumCondition
- FileDateCondition
- FileExistsCondition
- FileSizeCondition
- FileVersionCondition
A better approach would be do the append the path to a more generic place such as SetNauAttributes(INauFieldsHolder fieldsHolder, Dictionary<string, string> attributes)
method from Reflection.cs
but we didn't want to do this as we didn't want to break some other functionality (we saw that in some places you actually did something similar to what we did (for example in FileUpdateTask
class).
The mix of absolute/relative behavior should probably be refactored and standardized so it wouldn't cause the kind of problems we experienced.
Anyway, hope this helps if someone else stumbles into same problem or until this (hopefuly ;) gets fixed/refactored in a future version of the framework.
Also, thanks for creating the framework! :)
It helped us a lot.
Cheers