mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
@@ -81,6 +81,7 @@
|
||||
|
||||
if (cleanArgc > 0) {
|
||||
NSString *path = [NSString stringWithUTF8String:cleanArgv[0]];
|
||||
path = [self standardizePathToOpen:path withArguments:arguments];
|
||||
NSString *executedFromPath =[arguments objectForKey:@"executed-from"];
|
||||
if (![path isAbsolutePath] && executedFromPath) {
|
||||
path = [executedFromPath stringByAppendingPathComponent:path];
|
||||
@@ -93,6 +94,16 @@
|
||||
return arguments;
|
||||
}
|
||||
|
||||
+ (NSString *)standardizePathToOpen:(NSString *)path withArguments:(NSDictionary *)arguments {
|
||||
NSString *standardizedPath = path;
|
||||
NSString *executedFromPath = [arguments objectForKey:@"executed-from"];
|
||||
if (![standardizedPath isAbsolutePath] && executedFromPath) {
|
||||
standardizedPath = [executedFromPath stringByAppendingPathComponent:standardizedPath];
|
||||
}
|
||||
standardizedPath = [standardizedPath stringByStandardizingPath];
|
||||
return standardizedPath;
|
||||
}
|
||||
|
||||
+ (NSString *)supportDirectory {
|
||||
NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) objectAtIndex:0];
|
||||
NSString *executableName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleExecutable"];
|
||||
@@ -166,6 +177,14 @@
|
||||
|
||||
# pragma mark NSApplicationDelegate
|
||||
|
||||
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames {
|
||||
for (int i = 0; i < [filenames count]; i++) {
|
||||
NSString *path = [filenames objectAtIndex:i];
|
||||
path = [[self class] standardizePathToOpen:path withArguments:self.arguments];
|
||||
[self open:path];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationWillFinishLaunching:(NSNotification *)notification {
|
||||
_backgroundWindowController = [[AtomWindowController alloc] initInBackground];
|
||||
|
||||
|
||||
@@ -20,6 +20,16 @@
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>public.folder</string>
|
||||
<string>public.plain-text</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
||||
Reference in New Issue
Block a user