File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -2526,12 +2526,8 @@ inline std::string base64_encode(const std::string &in) {
25262526}
25272527
25282528inline bool is_file (const std::string &path) {
2529- #ifdef _WIN32
2530- return _access_s (path.c_str (), 0 ) == 0 ;
2531- #else
25322529 struct stat st;
25332530 return stat (path.c_str (), &st) >= 0 && S_ISREG (st.st_mode );
2534- #endif
25352531}
25362532
25372533inline bool is_dir (const std::string &path) {
Original file line number Diff line number Diff line change @@ -7561,3 +7561,14 @@ TEST(UniversalClientImplTest, Ipv6LiteralAddress) {
75617561 CLIENT_PRIVATE_KEY_FILE);
75627562 EXPECT_EQ (cli.port (), port);
75637563}
7564+
7565+ TEST (FileSystemTest, FileAndDirExistenceCheck) {
7566+ auto file_path = " ./www/dir/index.html" ;
7567+ auto dir_path = " ./www/dir" ;
7568+
7569+ EXPECT_TRUE (detail::is_file (file_path));
7570+ EXPECT_FALSE (detail::is_dir (file_path));
7571+
7572+ EXPECT_FALSE (detail::is_file (dir_path));
7573+ EXPECT_TRUE (detail::is_dir (dir_path));
7574+ }
You can’t perform that action at this time.
0 commit comments