From 282e99b6b0b09958464ccfbb618d01b75e4f0e7f Mon Sep 17 00:00:00 2001 From: clanmills Date: Mon, 7 Jan 2019 17:02:54 +0000 Subject: [PATCH] Fix #610 (cherry picked from commit 54367e18ed0bf8bae6d8449341a6f82779f6d3c7) --- src/futils.cpp | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/src/futils.cpp b/src/futils.cpp index 8049c3db..2de5dc00 100644 --- a/src/futils.cpp +++ b/src/futils.cpp @@ -17,12 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. */ -/* - File: futils.cpp - Author(s): Andreas Huggel (ahu) - History: 08-Dec-03, ahu: created - 02-Apr-05, ahu: moved to Exiv2 namespace - */ // ***************************************************************************** // included header files #include "config.h" @@ -33,25 +27,26 @@ // + standard includes #include #include - -#ifdef _MSC_VER - #include - # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) - #include // For access to GetModuleFileNameEx -#elif defined(__APPLE__) - #include -#endif - -#ifdef EXV_HAVE_UNISTD_H - # include // for stat() -#endif - #include #include #include #include #include #include +#ifdef EXV_HAVE_UNISTD_H +#include // for stat() +#endif + +#if defined(WIN32) +#include +#include // For access to GetModuleFileNameEx +#endif + +#if defined(_MSC_VER) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#elif defined(__APPLE__) +#include +#endif namespace Exiv2 { const char* ENVARDEF[] = {"/exiv2.php", "40"}; //!< @brief default URL for http exiv2 handler and time-out @@ -471,7 +466,7 @@ namespace Exiv2 { if (proc_pidpath (pid, pathbuf, sizeof(pathbuf)) > 0) { ret = pathbuf; } - #elif defined(__linux__) || defined(__CYGWIN__) || defined(__MINGW__) + #elif defined(__linux__) || defined(__CYGWIN__) || defined(__MSYS__) // http://stackoverflow.com/questions/606041/how-do-i-get-the-path-of-a-process-in-unix-linux char proc[100]; char path[500]; @@ -482,11 +477,8 @@ namespace Exiv2 { ret = path; } #endif - #if defined(WIN32) - const size_t idxLastSeparator = ret.find_last_of('\\'); - #else - const size_t idxLastSeparator = ret.find_last_of('/'); - #endif + + const size_t idxLastSeparator = ret.find_last_of(EXV_SEPARATOR_STR); return ret.substr(0, idxLastSeparator); } } // namespace Exiv2