[macruby-changes] [4016] MacRuby/trunk/objc.m

source_changes at macosforge.org source_changes at macosforge.org
Mon May 3 22:50:13 PDT 2010


Revision: 4016
          http://trac.macosforge.org/projects/ruby/changeset/4016
Author:   martinlagardette at apple.com
Date:     2010-05-03 22:50:07 -0700 (Mon, 03 May 2010)
Log Message:
-----------
Fixes #669 + some style

Modified Paths:
--------------
    MacRuby/trunk/objc.m

Modified: MacRuby/trunk/objc.m
===================================================================
--- MacRuby/trunk/objc.m	2010-05-04 04:19:13 UTC (rev 4015)
+++ MacRuby/trunk/objc.m	2010-05-04 05:50:07 UTC (rev 4016)
@@ -358,14 +358,16 @@
     do { 								  \
 	path = [[dir stringByAppendingPathComponent:@"Frameworks"]	  \
 	   stringByAppendingPathComponent:frameworkName];		  \
-	if ([fileManager fileExistsAtPath:path])  			  \
+	if ([fileManager fileExistsAtPath:path]) {			  \
 	    goto success; 						  \
+	}								  \
 	path = [[dir stringByAppendingPathComponent:@"PrivateFrameworks"] \
 	   stringByAppendingPathComponent:frameworkName];		  \
-	if ([fileManager fileExistsAtPath:path]) 			  \
+	if ([fileManager fileExistsAtPath:path]) {			  \
 	    goto success; 						  \
+	}								  \
     } 									  \
-    while(0)
+    while (0)
 
 	pathDomainMask = RTEST(search_network)
 	    ? NSAllDomainsMask
@@ -399,8 +401,9 @@
     for (i = 0, count = [dirs count]; i < count; i++) {
         NSString *dir = [dirs objectAtIndex:i];
         path = [dir stringByAppendingPathComponent:frameworkName];
-        if ([fileManager fileExistsAtPath:path])
+        if ([fileManager fileExistsAtPath:path]) {
             goto success;
+	}
     }
 
 #undef FIND_LOAD_PATH_IN_LIBRARY
@@ -422,11 +425,8 @@
 		 cstr);
     }
 
-    if ([bundle isLoaded]) {
-	return Qfalse;
-    }
-
-    if (![bundle loadAndReturnError:&error]) {
+    const bool loaded = [bundle isLoaded];
+    if (!loaded && ![bundle loadAndReturnError:&error]) {
 	rb_raise(rb_eRuntimeError,
 		 "framework at path `%s' cannot be loaded: %s",
 		 cstr,
@@ -439,7 +439,7 @@
 
     enable_kvo_notifications = true;
 
-    return Qtrue;
+    return loaded ? Qfalse : Qtrue;
 }
 
 void rb_vm_init_compiler(void);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100503/cf536978/attachment.html>


More information about the macruby-changes mailing list