changeset 147:64712e72cb16

Fixes #32
author Jacob Carlborg <doob@me.com>
date Sun, 07 Jun 2009 00:04:52 +0200
parents 05e03d23ca3a
children 8944c1d87c63
files dwt/internal/cocoa/NSWorkspace.d dwt/program/Program.d
diffstat 2 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSWorkspace.d	Sat Jun 06 23:35:37 2009 +0200
+++ b/dwt/internal/cocoa/NSWorkspace.d	Sun Jun 07 00:04:52 2009 +0200
@@ -59,7 +59,7 @@
 }
 
 public bool getInfoForFile(NSString fullPath, ref objc.id appName, ref objc.id type) {
-    return OS.objc_msgSend_bool(this.id, OS.sel_getInfoForFile_application_type_, fullPath !is null ? fullPath.id : null, appName, type);
+    return OS.objc_msgSend_bool(this.id, OS.sel_getInfoForFile_application_type_, fullPath !is null ? fullPath.id : null, &appName, &type);
 }
 
 public NSImage iconForFile(NSString fullPath) {
--- a/dwt/program/Program.d	Sat Jun 06 23:35:37 2009 +0200
+++ b/dwt/program/Program.d	Sun Jun 07 00:04:52 2009 +0200
@@ -83,8 +83,8 @@
     NSAutoreleasePool pool = cast(NSAutoreleasePool) (new NSAutoreleasePool()).alloc().init();
     try {
         NSWorkspace workspace = NSWorkspace.sharedWorkspace();
-        objc.id appName = cast(objc.id) OS.malloc(C.PTR_SIZEOF);
-        objc.id type = cast(objc.id) OS.malloc(C.PTR_SIZEOF);
+        objc.id appName = new objc.objc_object;
+        objc.id type = new objc.objc_object;
         NSString temp = new NSString(OS.NSTemporaryDirectory());
         NSString fileName = NSString.stringWith("swt" ~ Format("{}", System.currentTimeMillis()) ~ extension);
         NSString fullPath = temp.stringByAppendingPathComponent(fileName);
@@ -92,10 +92,7 @@
         fileManager.createFileAtPath(fullPath, null, null);
         workspace.getInfoForFile(fullPath, appName, type);
         fileManager.removeItemAtPath(fullPath, null);
-        objc.id buffer;
-        OS.memmove(buffer, appName, C.PTR_SIZEOF);
-        OS.free(appName);
-        OS.free(type);
+        objc.id buffer = appName;
         if (buffer !is null) {
             NSString appPath = new NSString(buffer);
             NSBundle bundle = NSBundle.bundleWithPath(appPath);