1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-03 05:53:52 +00:00

Windows fixes

This commit is contained in:
Henry Fredrick Schreiner 2017-02-19 15:19:49 -05:00
parent 8725de6706
commit 2170b60cc7
2 changed files with 3 additions and 3 deletions

View File

@ -27,7 +27,7 @@ namespace CLI {
bool ExistingFile(std::string filename) { bool ExistingFile(std::string filename) {
struct stat buffer; struct stat buffer;
bool exist = stat(filename.c_str(), &buffer) == 0; bool exist = stat(filename.c_str(), &buffer) == 0;
bool is_dir = buffer.st_mode & S_IFDIR != 0; bool is_dir = (buffer.st_mode & S_IFDIR != 0);
if(!exist) { if(!exist) {
std::cerr << "File does not exist: " << filename << std::endl; std::cerr << "File does not exist: " << filename << std::endl;
return false; return false;
@ -43,7 +43,7 @@ bool ExistingFile(std::string filename) {
bool ExistingDirectory(std::string filename) { bool ExistingDirectory(std::string filename) {
struct stat buffer; struct stat buffer;
bool exist = stat(filename.c_str(), &buffer) == 0; bool exist = stat(filename.c_str(), &buffer) == 0;
bool is_dir = buffer.st_mode & S_IFDIR != 0; bool is_dir = (buffer.st_mode & S_IFDIR) != 0;
if(!exist) { if(!exist) {
std::cerr << "Directory does not exist: " << filename << std::endl; std::cerr << "Directory does not exist: " << filename << std::endl;
return false; return false;

View File

@ -489,7 +489,7 @@ TEST_F(TApp, RequiresChainedFlags) {
TEST_F(TApp, Env) { TEST_F(TApp, Env) {
put_env("CLI11_TEST_ENV_TMP", "2", true); put_env("CLI11_TEST_ENV_TMP", "2");
int val=1; int val=1;
CLI::Option* vopt = app.add_option("--tmp", val)->envname("CLI11_TEST_ENV_TMP"); CLI::Option* vopt = app.add_option("--tmp", val)->envname("CLI11_TEST_ENV_TMP");