From 461b9fa10629cfaec793371597eb2ca743c256bf Mon Sep 17 00:00:00 2001 From: Thomas Fussell Date: Wed, 3 Aug 2016 09:00:58 -0400 Subject: [PATCH] convert path_helper return to path --- tests/helpers/path_helper.hpp | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/tests/helpers/path_helper.hpp b/tests/helpers/path_helper.hpp index 73a0df2f..15b44070 100644 --- a/tests/helpers/path_helper.hpp +++ b/tests/helpers/path_helper.hpp @@ -52,30 +52,7 @@ public: sprintf(arg1, "/proc/%d/exe", getpid()); auto bytes_written = readlink(arg1, exepath, 1024); - return std::string(exepath).substr(0, bytes_written - 9); -#endif - } - - static xlnt::path get_working_directory(const std::string &append = "") - { -#ifdef _MSC_VER - TCHAR buffer[MAX_PATH]; - GetCurrentDirectory(MAX_PATH, buffer); - - std::basic_string working_directory(buffer); - std::string working_directory_narrow(working_directory.begin(), working_directory.end()); - - return xlnt::path(working_directory_narrow) - .append(xlnt::path(append)); -#else - char buffer[PATH_MAX]; - - if (getcwd(buffer, 2048) == nullptr) - { - throw std::runtime_error("getcwd failed"); - } - - return std::string(buffer); + return xlnt::path(std::string(exepath).substr(0, bytes_written - 9)); #endif }