Check readabilty only for existing files; Remove Exclusions when file is readable again
This commit is contained in:
parent
feaef086f3
commit
c80376a4b9
|
@ -66,7 +66,7 @@ namespace SparkleLib {
|
|||
|
||||
public abstract bool AddExclusionRule (FileSystemEventArgs args);
|
||||
public abstract bool RemoveExclusionRule (FileSystemEventArgs args);
|
||||
public abstract bool CheckExclusionRules ();
|
||||
public abstract bool ExclusionRuleExists (FileSystemEventArgs args);
|
||||
|
||||
public delegate void SyncStatusChangedEventHandler (SyncStatus new_status);
|
||||
public event SyncStatusChangedEventHandler SyncStatusChanged;
|
||||
|
@ -321,18 +321,36 @@ namespace SparkleLib {
|
|||
return;
|
||||
|
||||
/*
|
||||
* Check whether the file which triggered the action
|
||||
* is readable so that git can actually commit it
|
||||
*/
|
||||
|
||||
* Check whether the file which triggered the action
|
||||
* is readable so that git can actually commit it
|
||||
*/
|
||||
try {
|
||||
FileStream file = File.OpenRead(args.FullPath);
|
||||
file.Close();
|
||||
if(File.Exists(args.FullPath)) {
|
||||
FileStream file = File.OpenRead(args.FullPath);
|
||||
file.Close();
|
||||
}
|
||||
} catch {
|
||||
SparkleHelpers.DebugInfo("Warning", "File " + args.FullPath + " is not readable. Adding to ignore list.");
|
||||
AddExclusionRule(args);
|
||||
if(!ExclusionRuleExists(args)) {
|
||||
SparkleHelpers.DebugInfo("Warning", "File " + args.FullPath + " is not readable. Adding to ignore list.");
|
||||
AddExclusionRule(args);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove rule if file is readable but there is still
|
||||
* an exclusion rule set
|
||||
*/
|
||||
if(ExclusionRuleExists(args)) {
|
||||
SparkleHelpers.DebugInfo("Info", "Removing exclusion rule for " + args.Name);
|
||||
RemoveExclusionRule(args);
|
||||
|
||||
// If a file was former unreadable but has now been (re)moved, skip the process.
|
||||
if(!File.Exists(args.FullPath)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
WatcherChangeTypes wct = args.ChangeType;
|
||||
|
||||
|
|
Loading…
Reference in a new issue