Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BSVino committed Jul 10, 2016
2 parents 42b3fca + 11bcfb5 commit e5a9d5e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions renderer/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON A
#include <iostream>
#include <fstream>
#include <string.h>
#ifdef __APPLE__
#include <unistd.h>
#endif

#include <strutils.h>
#include <common_platform.h>
Expand Down Expand Up @@ -50,8 +53,17 @@ CApplication::CApplication(int argc, char** argv)

bool CApplication::OpenWindow(size_t iWidth, size_t iHeight, bool bFullscreen, bool bResizeable)
{
if (!glfwInit())
{
#ifdef __APPLE__
// On macOS, glfwInit() can change the current directory.
// See http://www.glfw.org/docs/latest/group__init.html
char *cwd = getcwd(0, 0);
int ret = glfwInit();
chdir(cwd);
free(cwd);
#else
int ret = glfwInit();
#endif
if (!ret) {
printf("glfwInit failed\n");
exit(1);
}
Expand Down

0 comments on commit e5a9d5e

Please sign in to comment.