From 88d157178b1574bf20ae3436409717906f3cfb1b Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 29 Aug 2011 17:02:41 -0700 Subject: [PATCH] jscocoa.js holds a subset of the methods from jscocoa's class.js --- src/jscocoa.coffee | 15 +++++++++++++++ src/osx.coffee | 7 ++++--- 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 src/jscocoa.coffee diff --git a/src/jscocoa.coffee b/src/jscocoa.coffee new file mode 100644 index 000000000..632405eef --- /dev/null +++ b/src/jscocoa.coffee @@ -0,0 +1,15 @@ +# This is where we put things from JSCocoa's class.js file + +exports.outArgument = (args...) -> + # Derive to store some javascript data in the internal hash + if not @outArgument2? + OSX.JSCocoa.createClass_parentClass_('JSCocoaOutArgument2', 'JSCocoaOutArgument') + + console.log(OSX.JSCocoaOutArgument2) + o = OSX.JSCocoaOutArgument2.instance + o.isOutArgument = true + if args.length == 2 + o.mateWithMemoryBuffer_atIndex_(args[0], args[1]) + + o + diff --git a/src/osx.coffee b/src/osx.coffee index 9f96f05c8..83ba32c43 100644 --- a/src/osx.coffee +++ b/src/osx.coffee @@ -2,6 +2,7 @@ $ = require 'jquery' _ = require 'underscore' +jscocoa = require 'jscocoa' # Handles the UI chrome Chrome = @@ -25,11 +26,11 @@ Chrome = else throw "I DON'T KNOW HOW TO DEAL WITH #{position}" - # path - Optional. The String path to the file to base it on. inspector: (webView) -> webView ?= WindowController.webView @_inspector ?= OSX.WebInspector.alloc.initWithWebView webView + # path - Optional. The String path to the file to base it on. createWindow: (path) -> c = OSX.AtomWindowController.alloc.initWithWindowNibName "AtomWindow" c.window @@ -92,7 +93,7 @@ File = else path isFile: (path) -> - isDir = new outArgument + isDir = new jscocoa.outArgument exists = OSX.NSFileManager.defaultManager.fileExistsAtPath_isDirectory(path, isDir) exists and not isDir.valueOf() @@ -106,7 +107,7 @@ Dir = paths = fm.contentsOfDirectoryAtPath_error path, null _.map paths, (entry) -> "#{path}/#{entry}" isDir: (path) -> - isDir = new outArgument + isDir = new jscocoa.outArgument exists = OSX.NSFileManager.defaultManager.fileExistsAtPath_isDirectory(path, isDir) exists and isDir.valueOf()