From 67f31c080e2497608e5ef14236a3b7d1a261e192 Mon Sep 17 00:00:00 2001
From: neil <neil@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Sun, 16 May 2010 00:28:02 +0000
Subject: [PATCH] Support running bootstrap from bundle

git-svn-id: http://svn.net-core.org/repos/t-engine4@617 51575b47-30f0-44d4-a5cc-537603b46e54
---
 bootstrap/boot.lua | 6 ++++--
 src/main.c         | 6 ++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/bootstrap/boot.lua b/bootstrap/boot.lua
index f78be7186d..d6f51d256b 100644
--- a/bootstrap/boot.lua
+++ b/bootstrap/boot.lua
@@ -11,8 +11,10 @@ if __SELFEXE then
 	-- Remove bin/Debug from the path, to make dev easier
 	dir = dir:gsub("bin"..fs.getPathSeparator().."Debug"..fs.getPathSeparator(), "")
 
-	-- Now remove executable name
-	dir = dir:gsub("(.*"..fs.getPathSeparator()..").+", "%1")
+	if not __APPLE__ then
+		-- Now remove executable name
+		dir = dir:gsub("(.*"..fs.getPathSeparator()..").+", "%1")
+	end
 
 	print("SelfExe gave us app directory of:", dir)
 	fs.mount(dir..fs.getPathSeparator().."game"..fs.getPathSeparator().."thirdparty", "/", true)
diff --git a/src/main.c b/src/main.c
index 5f17f6592c..4921c6db19 100644
--- a/src/main.c
+++ b/src/main.c
@@ -462,6 +462,12 @@ int main(int argc, char *argv[])
 		lua_pushnil(L);
 	lua_setglobal(L, "__SELFEXE");
 
+	// Will be useful
+#ifdef __APPLE__
+	lua_pushboolean(L, TRUE);
+	lua_setglobal(L, "__APPLE__");
+#endif
+
 	// Run bootstrapping
 	if (!luaL_loadfile(L, "/bootstrap/boot.lua"))
 	{
-- 
GitLab