do not use wordexp on unsupported systems
parent
741f326eb4
commit
02bcf41173
|
@ -299,6 +299,8 @@ include_directories("${CMAKE_SOURCE_DIR}/src" ${CMAKE_BINARY_DIR})
|
|||
|
||||
# configure a header file to pass some of the CMake settings
|
||||
# to the source code
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(wordexp wordexp.h HAVE_WORDEXP)
|
||||
check_include_files(byteswap.h HAVE_BYTESWAP_H)
|
||||
check_include_file_cxx(experimental/filesystem HAVE_EXPERIMENTAL_FILESYSTEM)
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#cmakedefine HAVE_BYTESWAP_H
|
||||
#cmakedefine HAVE_FILESYSTEM
|
||||
#cmakedefine HAVE_EXPERIMENTAL_FILESYSTEM
|
||||
#cmakedefine HAVE_WORDEXP
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
|
||||
#include <config.h>
|
||||
#include <celutil/debug.h>
|
||||
#include "util.h"
|
||||
#ifdef _WIN32
|
||||
|
@ -17,8 +18,10 @@
|
|||
#else
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
#ifdef HAVE_WORDEXP
|
||||
#include <wordexp.h>
|
||||
#endif
|
||||
#endif // HAVE_WORDEXP
|
||||
#endif // !_WIN32
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -101,7 +104,7 @@ fs::path PathExp(const fs::path& filename)
|
|||
}
|
||||
|
||||
return filename;
|
||||
#else
|
||||
#elif defined(HAVE_WORDEXP)
|
||||
wordexp_t result;
|
||||
|
||||
switch(wordexp(filename.string().c_str(), &result, WRDE_NOCMD))
|
||||
|
@ -125,6 +128,8 @@ fs::path PathExp(const fs::path& filename)
|
|||
fs::path::string_type expanded(result.we_wordv[0]);
|
||||
wordfree(&result);
|
||||
return expanded;
|
||||
#else
|
||||
return filename;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue