Commit 2170b60cc7e8b02cd709e1c4bc1d3d6b19dc9356

Authored by Henry Fredrick Schreiner
1 parent 8725de67

Windows fixes

include/CLI/Validators.hpp
@@ -27,7 +27,7 @@ namespace CLI { @@ -27,7 +27,7 @@ namespace CLI {
27 bool ExistingFile(std::string filename) { 27 bool ExistingFile(std::string filename) {
28 struct stat buffer; 28 struct stat buffer;
29 bool exist = stat(filename.c_str(), &buffer) == 0; 29 bool exist = stat(filename.c_str(), &buffer) == 0;
30 - bool is_dir = buffer.st_mode & S_IFDIR != 0; 30 + bool is_dir = (buffer.st_mode & S_IFDIR != 0);
31 if(!exist) { 31 if(!exist) {
32 std::cerr << "File does not exist: " << filename << std::endl; 32 std::cerr << "File does not exist: " << filename << std::endl;
33 return false; 33 return false;
@@ -43,7 +43,7 @@ bool ExistingFile(std::string filename) { @@ -43,7 +43,7 @@ bool ExistingFile(std::string filename) {
43 bool ExistingDirectory(std::string filename) { 43 bool ExistingDirectory(std::string filename) {
44 struct stat buffer; 44 struct stat buffer;
45 bool exist = stat(filename.c_str(), &buffer) == 0; 45 bool exist = stat(filename.c_str(), &buffer) == 0;
46 - bool is_dir = buffer.st_mode & S_IFDIR != 0; 46 + bool is_dir = (buffer.st_mode & S_IFDIR) != 0;
47 if(!exist) { 47 if(!exist) {
48 std::cerr << "Directory does not exist: " << filename << std::endl; 48 std::cerr << "Directory does not exist: " << filename << std::endl;
49 return false; 49 return false;
tests/AppTest.cpp
@@ -489,7 +489,7 @@ TEST_F(TApp, RequiresChainedFlags) { @@ -489,7 +489,7 @@ TEST_F(TApp, RequiresChainedFlags) {
489 489
490 TEST_F(TApp, Env) { 490 TEST_F(TApp, Env) {
491 491
492 - put_env("CLI11_TEST_ENV_TMP", "2", true); 492 + put_env("CLI11_TEST_ENV_TMP", "2");
493 493
494 int val=1; 494 int val=1;
495 CLI::Option* vopt = app.add_option("--tmp", val)->envname("CLI11_TEST_ENV_TMP"); 495 CLI::Option* vopt = app.add_option("--tmp", val)->envname("CLI11_TEST_ENV_TMP");