Browse Source

Backed out changeset 7e5b88e76bda

Bart van Strien 13 years ago
parent
commit
329a6328db
1 changed files with 4 additions and 21 deletions
  1. 4 21
      src/love.cpp

+ 4 - 21
src/love.cpp

@@ -126,7 +126,7 @@ extern "C" LOVE_EXPORT int luaopen_love(lua_State * L)
 	}
 
 	lua_setfield(L, -2, "_version_compat");
-
+	
 #ifdef LOVE_WINDOWS
 	lua_pushstring(L, "Windows");
 #elif defined(LOVE_MACOSX)
@@ -199,29 +199,13 @@ int w__openConsole(lua_State * L)
 	if (is_open)
 		return 0;
 
-	is_open = true;
-
 	static const int MAX_CONSOLE_LINES = 5000;
 	long std_handle;
 	int console_handle;
 	CONSOLE_SCREEN_BUFFER_INFO console_info;
 	FILE *fp;
 
-	/* Legendary AttachConsole bug workaround.
-	 * AttachConsole breaks console allocation completely if it fails.
-	 * Let's check through the environment variable PROMPT if love was
-	 * started with cmd.exe.
-	*/
-	if (GetEnvironmentVariable(TEXT("PROMPT"), NULL, 0) != 0)
-	{
-		if (AttachConsole(ATTACH_PARENT_PROCESS) == 0)
-			return 0;
-	}
-	else
-	{
-		if (AllocConsole() == 0)
-			return 0;
-	}
+	AllocConsole();
 
 	// Set size.
 	GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &console_info);
@@ -254,6 +238,8 @@ int w__openConsole(lua_State * L)
 	// Sync std::cout, std::cerr, etc.
 	std::ios::sync_with_stdio();
 
+	is_open = true;
+
 	return 0;
 }
 
@@ -320,9 +306,6 @@ extern "C" LOVE_EXPORT int lovemain(int argc, char ** argv)
 	// Oh, you just want the version? Okay!
 	if (argc > 1 && strcmp(argv[1],"--version") == 0)
 	{
-#ifdef LOVE_LEGENDARY_CONSOLE_IO_HACK
-		w__openConsole(NULL);
-#endif // LOVE_LEGENDARY_CONSOLE_IO_HACK
 		printf("LOVE %s (%s)\n", love::VERSION, love::VERSION_CODENAME);
 		return 0;
 	}