diff --git a/project/src/backend/sdl/SDLApplication.cpp b/project/src/backend/sdl/SDLApplication.cpp index d02d8c437..1d8625505 100644 --- a/project/src/backend/sdl/SDLApplication.cpp +++ b/project/src/backend/sdl/SDLApplication.cpp @@ -1,5 +1,9 @@ #include "SDLApplication.h" +#ifdef HX_MACOS +#include +#endif + namespace lime { @@ -18,6 +22,18 @@ namespace lime { SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER); + #ifdef HX_MACOS + // set working directory for OS X + CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL (CFBundleGetMainBundle ()); + char path[PATH_MAX]; + if (CFURLGetFileSystemRepresentation (resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) { + + chdir(path); + + } + CFRelease(resourcesURL); + #endif + currentUpdate = 0; lastUpdate = 0; nextUpdate = 0; @@ -314,4 +330,4 @@ namespace lime { } -} \ No newline at end of file +} diff --git a/templates/haxe/DefaultAssetLibrary.hx b/templates/haxe/DefaultAssetLibrary.hx index c72f1b8f9..23abb10e1 100644 --- a/templates/haxe/DefaultAssetLibrary.hx +++ b/templates/haxe/DefaultAssetLibrary.hx @@ -71,11 +71,7 @@ class DefaultAssetLibrary extends AssetLibrary { if (Sys.args ().indexOf ("-livereload") > -1) { - #if mac - var path = FileSystem.fullPath ("../Resources/manifest"); - #else var path = FileSystem.fullPath ("manifest"); - #end lastModified = FileSystem.stat (path).mtime.getTime (); timer = new Timer (2000);