diff --git a/native/atom_application.mm b/native/atom_application.mm
index 769dbdbc2..fb7b09150 100644
--- a/native/atom_application.mm
+++ b/native/atom_application.mm
@@ -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];
diff --git a/native/mac/info.plist b/native/mac/info.plist
index 9dd8973e8..d168799f2 100644
--- a/native/mac/info.plist
+++ b/native/mac/info.plist
@@ -20,6 +20,16 @@
????
CFBundleVersion
1.0
+ CFBundleDocumentTypes
+
+
+ LSItemContentTypes
+
+ public.folder
+ public.plain-text
+
+
+
NSMainNibFile
MainMenu
NSPrincipalClass