Changeset 12676
- Timestamp:
- Aug 25, 2009, 10:51:59 AM (15 years ago)
- Location:
- trunk/source
- Files:
-
- 4 edited
-
cocoa-ide/build-application.lisp (modified) (2 diffs)
-
cocoa-ide/builder-utilities.lisp (modified) (3 diffs)
-
cocoa-ide/start.lisp (modified) (1 diff)
-
lib/dumplisp.lisp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/cocoa-ide/build-application.lisp
r9827 r12676 51 51 ;; create the bundle directory 52 52 (app-bundle (make-application-bundle :name name :project-path directory)) 53 (image-path (namestring (path app-bundle "Contents" "MacOS" name)))) 53 (image-path (namestring (path (bundle-executable-path app-bundle) 54 (bundle-executable-name name))))) 54 55 ;; maybe copy IDE resources to the bundle 55 56 (when copy-ide-resources … … 75 76 :application-class application-class 76 77 :toplevel-function toplevel-function 77 :prepend-kernel t))) 78 :prepend-kernel t 79 #+windows-target #+windows-target 80 :application-type :gui))) 78 81 79 82 -
trunk/source/cocoa-ide/builder-utilities.lisp
r11593 r12676 263 263 (type-str (%make-nsstring package-type)) 264 264 (sig-str (%make-nsstring bundle-signature)) 265 (app-name-str (%make-nsstring name))265 (app-name-str (%make-nsstring (bundle-executable-name name))) 266 266 (app-plist-path-str (%make-nsstring (namestring out-path)))) 267 267 (#/setValue:forKey: info-dict bundle-name-str $cfbundle-bundle-name-key) … … 300 300 (read-info-plist ide-plist-path-str))) 301 301 302 ;;; BUNNDLE-EXECUTABLE-PATH app-path 303 ;;; ------------------------------------------------------------------------ 304 ;;; Returns the pathname of the executable directory given the pathname of 305 ;;; an application bundle 306 (defun bundle-executable-path (app-path) 307 (path app-path "Contents" 308 #-windows-target (ensure-directory-pathname "MacOS") 309 #+windows-target (ensure-directory-pathname "Windows"))) 310 311 ;;; BUNNDLE-EXECUTABLE-NAME name 312 ;;; ------------------------------------------------------------------------ 313 ;;; Returns the name of the executable file for an application bundle 314 (defun bundle-executable-name (name) 315 #-windows-target name 316 #+windows-target (concatenate 'string name ".exe")) 317 302 318 ;;; MAKE-APPLICATION-BUNDLE name package-type bundle-signature project-path 303 319 ;;; ------------------------------------------------------------------------ … … 310 326 (ensure-directory-pathname (concatenate 'string name ".app")))) 311 327 (contents-dir (path app-bundle (ensure-directory-pathname "Contents"))) 312 ( macos-dir (path contents-dir (ensure-directory-pathname "MacOS")))328 (executable-dir (bundle-executable-path app-bundle)) 313 329 (rsrc-dir (path contents-dir "Resources" 314 330 (ensure-directory-pathname "English.lproj")))) 315 (ensure-directories-exist macos-dir)331 (ensure-directories-exist executable-dir) 316 332 (ensure-directories-exist rsrc-dir) 317 333 app-bundle)) -
trunk/source/cocoa-ide/start.lisp
r12641 r12676 153 153 (save-application image-file 154 154 :prepend-kernel t 155 :application-class 'cocoa-application))) 155 :application-class 'cocoa-application 156 #+windows-target #+windows-target 157 :application-type :gui))) 156 158 157 159 ;;; If we're running as a standalone .app, try to see if a bundle named -
trunk/source/lib/dumplisp.lisp
r12167 r12676 73 73 (mode #o644) 74 74 prepend-kernel 75 )75 #+windows-target (application-type :console)) 76 76 (declare (ignore toplevel-function error-handler application-class 77 77 clear-clos-caches init-file impurify)) 78 #+windows-target (check-type application-type (member :console :gui)) 78 79 (unless (probe-file (make-pathname :defaults nil 79 80 :directory (pathname-directory (translate-logical-pathname filename)))) … … 87 88 (let* ((fd (open-dumplisp-file filename 88 89 :mode mode 89 :prepend-kernel prepend-kernel))) 90 :prepend-kernel prepend-kernel 91 #+windows-target #+windows-target 92 :application-type application-type))) 90 93 (process-interrupt ip 91 94 #'(lambda () … … 109 112 (init-file nil init-file-p) 110 113 (clear-clos-caches t) 111 prepend-kernel) 112 (declare (ignore mode prepend-kernel)) 114 prepend-kernel 115 #+windows-target application-type) 116 (declare (ignore mode prepend-kernel #+windows-target application-type)) 113 117 (when (and application-class (neq (class-of *application*) 114 118 (if (symbolp application-class) … … 190 194 191 195 192 (defun %prepend-file (out-fd in-fd len )196 (defun %prepend-file (out-fd in-fd len #+windows-target application-type) 193 197 (declare (fixnum out-fd in-fd len)) 194 198 (fd-lseek in-fd 0 #$SEEK_SET) 195 (let* ((bufsize (ash 1 15))) 199 (let* ((bufsize (ash 1 15)) 200 #+windows-target (first-buf t)) 196 201 (%stack-block ((buf bufsize)) 197 202 (loop … … 201 206 (if (< nread 0) 202 207 (%errno-disp nread)) 203 (let* ((nwritten (fd-write out-fd buf nread))) 208 #+windows-target 209 (when (shiftf first-buf nil) 210 (let* ((application-byte (ecase application-type 211 (:console #$IMAGE_SUBSYSTEM_WINDOWS_CUI) 212 (:gui #$IMAGE_SUBSYSTEM_WINDOWS_GUI))) 213 (offset (%get-long buf #x3c))) 214 (assert (< offset bufsize) () "PEF header not within first ~D bytes" bufsize) 215 (assert (= (%get-byte buf (+ offset 0)) (char-code #\P)) () 216 "File does not appear to be a PEF file") 217 (assert (= (%get-byte buf (+ offset 1)) (char-code #\E)) () 218 "File does not appear to be a PEF file") 219 (assert (= (%get-byte buf (+ offset 2)) 0) () 220 "File does not appear to be a PEF file") 221 (assert (= (%get-byte buf (+ offset 3)) 0) () 222 "File does not appear to be a PEF file") 223 ;; File is a PEF file -- Windows subsystem byte goes at offset 68 in the 224 ;; "optional header" which appears right after the standard header (20 bytes) 225 ;; and the PEF cookie (4 bytes) 226 (setf (%get-byte buf (+ offset 4 20 68)) application-byte))) 227 (let* ((nwritten (fd-write out-fd buf nread))) 204 228 (declare (fixnum nwritten)) 205 229 (unless (= nwritten nread) … … 221 245 222 246 223 (defun open-dumplisp-file (path &key (mode #o666) prepend-kernel) 247 (defun open-dumplisp-file (path &key (mode #o666) prepend-kernel 248 #+windows-target application-type) 224 249 (let* ((prepend-path (if prepend-kernel 225 250 (if (eq prepend-kernel t) … … 239 264 (let* ((image-fd (fd-open filename (logior #$O_WRONLY #$O_CREAT) mode))) 240 265 (unless (>= image-fd 0) (signal-file-error image-fd filename)) 266 (when prepend-fd 267 (%prepend-file image-fd prepend-fd prepend-len #+windows-target application-type)) 241 268 (fd-chmod image-fd mode) 242 (when prepend-fd243 (%prepend-file image-fd prepend-fd prepend-len))244 269 image-fd))) 245 270
Note:
See TracChangeset
for help on using the changeset viewer.
