mirror of
https://github.com/atom/atom.git
synced 2026-02-10 22:55:09 -05:00
Ported absolute and isFile to Objective-c.
This took fileFinder loading from .8 seconds to .35 seconds.
This commit is contained in:
@@ -155,6 +155,25 @@
|
||||
});
|
||||
}
|
||||
|
||||
- (BOOL)isFile:(NSString *)path {
|
||||
BOOL isDir;
|
||||
BOOL exists;
|
||||
exists = [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDir];
|
||||
return exists && !isDir;
|
||||
}
|
||||
|
||||
- (NSString *)absolute:(NSString *)path {
|
||||
path = [path stringByStandardizingPath];
|
||||
if ([path characterAtIndex:0] == '/') {
|
||||
return path;
|
||||
}
|
||||
|
||||
NSString *resolvedPath = [[NSFileManager defaultManager] currentDirectoryPath];
|
||||
resolvedPath = [[resolvedPath stringByAppendingPathComponent:path] stringByStandardizingPath];
|
||||
|
||||
return resolvedPath;
|
||||
}
|
||||
|
||||
#pragma mark NSWindowDelegate
|
||||
- (BOOL)windowShouldClose:(id)sender {
|
||||
[self close];
|
||||
|
||||
Reference in New Issue
Block a user