瀏覽代碼

Tighter memory management when checking for .love files in the Mac application’s Resources folder.

Xcode 4.2 or greater is now required to build LÖVE in OS X
Alex Szpakowski 12 年之前
父節點
當前提交
d4b71c8958
共有 1 個文件被更改,包括 8 次插入5 次删除
  1. 8 5
      platform/macosx/OSX.mm

+ 8 - 5
platform/macosx/OSX.mm

@@ -32,12 +32,15 @@ std::string getLoveInResources()
 {
 	std::string path;
 
-	// check to see if there are any .love files in Resources - props to stevejohnson/diordna
-	NSArray *lovePaths = [[NSBundle mainBundle] pathsForResourcesOfType:@"love" inDirectory:nil];
-	if ([lovePaths count] > 0)
+	@autoreleasepool
 	{
-		NSString *firstLovePath = [lovePaths objectAtIndex:0];
-		path = std::string([firstLovePath UTF8String]);
+		// check to see if there are any .love files in Resources - props to stevejohnson/diordna
+		NSArray *lovePaths = [[NSBundle mainBundle] pathsForResourcesOfType:@"love" inDirectory:nil];
+		if ([lovePaths count] > 0)
+		{
+			NSString *firstLovePath = [lovePaths objectAtIndex:0];
+			path = std::string([firstLovePath UTF8String]);
+		}
 	}
 
 	return path;