File tree Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -79,18 +79,29 @@ - (BOOL) _indexChanged {
79
79
}
80
80
81
81
- (BOOL ) _gitDirectoryChanged {
82
- BOOL isDirectory;
83
- NSDate *touchDate;
84
82
85
- for (NSString *filename in [[NSFileManager defaultManager ] directoryContentsAtPath: repository.fileURL.path]) {
86
- NSString *filepath = [repository.fileURL.path stringByAppendingPathComponent: filename];
87
- [[NSFileManager defaultManager ] fileExistsAtPath: filepath isDirectory: &isDirectory];
83
+ for (NSURL * fileURL in [[NSFileManager defaultManager ] contentsOfDirectoryAtURL: repository.fileURL
84
+ includingPropertiesForKeys: [NSArray arrayWithObject: NSURLContentModificationDateKey ]
85
+ options: 0
86
+
87
+ error: nil ])
88
+ {
89
+ BOOL isDirectory = NO ;
90
+ [[NSFileManager defaultManager ] fileExistsAtPath: [fileURL path ] isDirectory: &isDirectory];
88
91
if (isDirectory)
89
92
continue ;
90
93
91
- touchDate = [self _fileModificationDateAtPath: filepath];
92
- if ([gitDirTouchDate isLessThan: touchDate]) {
93
- gitDirTouchDate = touchDate;
94
+ NSDate * modTime = nil ;
95
+ if (![fileURL getResourceValue: &modTime forKey: NSURLContentModificationDateKey error: nil ])
96
+ continue ;
97
+
98
+ if (gitDirTouchDate == nil || [modTime compare: gitDirTouchDate] == NSOrderedDescending)
99
+ {
100
+ NSDate * newModTime = [[modTime laterDate: gitDirTouchDate] retain ];
101
+ if (gitDirTouchDate)
102
+ [gitDirTouchDate release ];
103
+
104
+ gitDirTouchDate = newModTime;
94
105
return YES ;
95
106
}
96
107
}
You can’t perform that action at this time.
0 commit comments