From: Mikko Rasa Date: Mon, 6 Jan 2014 19:53:25 +0000 (+0200) Subject: Windows uses ; as separator in $PATH X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=commitdiff_plain;h=2a6afe61db5603d508468adbd538ad4e96acc3fc Windows uses ; as separator in $PATH --- 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)) {