From f625e36f5c10ece06a6444b2a9db139e8767cf52 Mon Sep 17 00:00:00 2001 From: Andrea Odetti Date: Sun, 21 May 2017 14:04:24 +0100 Subject: [PATCH] Fix usage of getcwd. Signed-off-by: Andrea Odetti --- source/frontends/ncurses/main.cpp | 2 ++ source/linux/wwrapper.cpp | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/source/frontends/ncurses/main.cpp b/source/frontends/ncurses/main.cpp index fc70756f..0cc67365 100644 --- a/source/frontends/ncurses/main.cpp +++ b/source/frontends/ncurses/main.cpp @@ -99,6 +99,8 @@ void foo(int argc, const char * argv []) g_fh = fopen("/tmp/applewin.txt", "w"); setbuf(g_fh, NULL); + LogFileOutput("Initialisation\n"); + ImageInitialize(); DiskInitialize(); int nError = 0; // TODO: Show error MsgBox if we get a DiskInsert error diff --git a/source/linux/wwrapper.cpp b/source/linux/wwrapper.cpp index 0c2e3931..b3c18c83 100644 --- a/source/linux/wwrapper.cpp +++ b/source/linux/wwrapper.cpp @@ -203,7 +203,6 @@ HRSRC FindResource(void *, const std::string & filename, const char *) if (result.data.empty()) { LogFileOutput("FindResource: could not load resource %s\n", filename.c_str()); - printf("pippo\n"); } return result; @@ -233,8 +232,16 @@ DWORD timeGetTime() DWORD GetCurrentDirectory(DWORD length, char * buffer) { - getcwd(buffer, length); - return 0; + const char * cwd = getcwd(buffer, length); + + if (cwd) + { + return strlen(buffer); + } + else + { + return 0; + } } UINT64 _strtoui64(const char * str, void *, int)