Check readabilty only for existing files; Remove Exclusions when file is readable again
This commit is contained in:
parent
85abd6bbb7
commit
73f58892e8
|
@ -66,7 +66,7 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public abstract bool AddExclusionRule (FileSystemEventArgs args);
|
public abstract bool AddExclusionRule (FileSystemEventArgs args);
|
||||||
public abstract bool RemoveExclusionRule (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 delegate void SyncStatusChangedEventHandler (SyncStatus new_status);
|
||||||
public event SyncStatusChangedEventHandler SyncStatusChanged;
|
public event SyncStatusChangedEventHandler SyncStatusChanged;
|
||||||
|
@ -321,18 +321,36 @@ namespace SparkleLib {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check whether the file which triggered the action
|
* Check whether the file which triggered the action
|
||||||
* is readable so that git can actually commit it
|
* is readable so that git can actually commit it
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FileStream file = File.OpenRead(args.FullPath);
|
if(File.Exists(args.FullPath)) {
|
||||||
file.Close();
|
FileStream file = File.OpenRead(args.FullPath);
|
||||||
|
file.Close();
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
SparkleHelpers.DebugInfo("Warning", "File " + args.FullPath + " is not readable. Adding to ignore list.");
|
if(!ExclusionRuleExists(args)) {
|
||||||
AddExclusionRule(args);
|
SparkleHelpers.DebugInfo("Warning", "File " + args.FullPath + " is not readable. Adding to ignore list.");
|
||||||
|
AddExclusionRule(args);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
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;
|
WatcherChangeTypes wct = args.ChangeType;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue