File tree 2 files changed +11
-4
lines changed
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) {
2526
2526
}
2527
2527
2528
2528
inline bool is_file (const std::string &path) {
2529
- #ifdef _WIN32
2530
- return _access_s (path.c_str (), 0 ) == 0 ;
2531
- #else
2532
2529
struct stat st;
2533
2530
return stat (path.c_str (), &st) >= 0 && S_ISREG (st.st_mode );
2534
- #endif
2535
2531
}
2536
2532
2537
2533
inline bool is_dir (const std::string &path) {
Original file line number Diff line number Diff line change @@ -7561,3 +7561,14 @@ TEST(UniversalClientImplTest, Ipv6LiteralAddress) {
7561
7561
CLIENT_PRIVATE_KEY_FILE);
7562
7562
EXPECT_EQ (cli.port (), port);
7563
7563
}
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