From f6001b3d689995dc07ef81c9797781ddba3c520e Mon Sep 17 00:00:00 2001 From: Boincacm Date: Sun, 9 Oct 2016 17:41:03 +0000 Subject: [PATCH] Fixed execution time error in android --- samples/wrapper/wrapper.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/wrapper/wrapper.cpp b/samples/wrapper/wrapper.cpp index 7c19f9f527..b1b1fe0eef 100644 --- a/samples/wrapper/wrapper.cpp +++ b/samples/wrapper/wrapper.cpp @@ -304,9 +304,10 @@ void macro_substitute(string &str) { fprintf(stderr, "[DEBUG] replacing '%s' with '%s'\n", "$PWD", nt); #endif #else - str_replace_all(str, "$PWD", getenv("PWD")); + char cwd[1024]; + str_replace_all(str, "$PWD", getcwd(cwd, sizeof(cwd))); #ifdef DEBUG - fprintf(stderr, "[DEBUG] replacing '%s' with '%s'\n", "$PWD", getenv("PWD")); + fprintf(stderr, "[DEBUG] replacing '%s' with '%s'\n", "$PWD", getcwd(cwd, sizeof(cwd))); #endif #endif }