cocoa: hack around NSApplication's handling of command-line arguments
original commit: 3479f5fb92a68b8bcdd18c557ca03c17f43cd9e6
This commit is contained in:
parent
72b8c62748
commit
0e3f40b8c4
|
@ -29,9 +29,21 @@
|
||||||
queue-event
|
queue-event
|
||||||
yield)
|
yield)
|
||||||
|
|
||||||
(import-class NSApplication NSAutoreleasePool NSColor)
|
(import-class NSApplication NSAutoreleasePool NSColor NSProcessInfo NSArray)
|
||||||
(import-protocol NSApplicationDelegate)
|
(import-protocol NSApplicationDelegate)
|
||||||
|
|
||||||
|
;; Extreme hackery to hide original arguments from
|
||||||
|
;; NSApplication, because NSApplication wants to turn
|
||||||
|
;; the arguments into `application:openFile:' calls.
|
||||||
|
;; To hide the arguments, we replace the implementation
|
||||||
|
;; of `arguments' in the NSProcessInfo object.
|
||||||
|
(define (hack-argument-replacement self method)
|
||||||
|
(tell NSArray
|
||||||
|
arrayWithObjects: #:type (_vector i _NSString) (vector (path->string (find-system-path 'exec-file)))
|
||||||
|
count: #:type _NSUInteger 1))
|
||||||
|
(let ([m (class_getInstanceMethod NSProcessInfo (selector arguments))])
|
||||||
|
(void (method_setImplementation m hack-argument-replacement)))
|
||||||
|
|
||||||
(define app (tell NSApplication sharedApplication))
|
(define app (tell NSApplication sharedApplication))
|
||||||
|
|
||||||
(define-objc-class MyApplicationDelegate NSObject #:protocols (NSApplicationDelegate)
|
(define-objc-class MyApplicationDelegate NSObject #:protocols (NSApplicationDelegate)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user