set data_path to exe location on Windows because the open file dialog change the working directory, change the render loop to update only in case of an event or the animated or redraw is true

This commit is contained in:
2018-03-08 22:37:30 +01:00
parent da54181754
commit 1033b056af
5 changed files with 28 additions and 19 deletions

View File

@@ -57,6 +57,22 @@ void App::initLog()
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* docpath = [paths objectAtIndex:0];
data_path = [docpath cStringUsingEncoding:NSASCIIStringEncoding];
#elif _WIN32
//CHAR my_documents[MAX_PATH];
//HRESULT result = SHGetFolderPathA(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, my_documents);
//HMODULE hModule = GetModuleHandle(NULL);
//CHAR path[MAX_PATH];
//GetModuleFileNameA(hModule, path, MAX_PATH);
//CHAR out_drive[MAX_PATH];
//CHAR out_path[MAX_PATH];
//_splitpath(path, out_drive, out_path, nullptr, nullptr);
//sprintf_s(path, "%s%s", out_drive, out_path);
//data_path = path;
CHAR path[MAX_PATH];
GetCurrentDirectoryA(sizeof(path), path);
data_path = path;
#endif
LogRemote::I.start();