From 2a6afe61db5603d508468adbd538ad4e96acc3fc Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 6 Jan 2014 21:53:25 +0200 Subject: [PATCH] Windows uses ; as separator in $PATH --- source/fs/dir.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/fs/dir.cpp b/source/fs/dir.cpp index 2ae5122..0b68732 100644 --- a/source/fs/dir.cpp +++ b/source/fs/dir.cpp @@ -17,6 +17,15 @@ namespace FS { namespace { +enum +{ +#ifdef WIN32 + ITEMSEP = ';' +#else + ITEMSEP = ':' +#endif +}; + /** Helper function to determine the location of the program's executable. Caches the last result to cut down filesystem access with repeated calls. */ const Path &get_bin_dir(const string &argv0) @@ -30,7 +39,7 @@ const Path &get_bin_dir(const string &argv0) if(argv0.find('/')==string::npos) { const char *path = getenv("PATH"); - vector dirs = split(path, ':'); + vector dirs = split(path, ITEMSEP); for(vector::const_iterator i=dirs.begin(); i!=dirs.end(); ++i) if(exists(Path(*i)/argv0)) { -- 2.43.0