File tree 2 files changed +16
-12
lines changed
2 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -2198,6 +2198,10 @@ make_basic_authentication_header(const std::string &username,
2198
2198
2199
2199
namespace detail {
2200
2200
2201
+ bool is_file(const std::string &path);
2202
+
2203
+ bool is_dir(const std::string &path);
2204
+
2201
2205
std::string encode_query_param(const std::string &value);
2202
2206
2203
2207
std::string decode_url(const std::string &s, bool convert_plus_to_space);
@@ -2525,16 +2529,6 @@ inline std::string base64_encode(const std::string &in) {
2525
2529
return out;
2526
2530
}
2527
2531
2528
- inline bool is_file(const std::string &path) {
2529
- struct stat st;
2530
- return stat(path.c_str(), &st) >= 0 && S_ISREG(st.st_mode);
2531
- }
2532
-
2533
- inline bool is_dir(const std::string &path) {
2534
- struct stat st;
2535
- return stat(path.c_str(), &st) >= 0 && S_ISDIR(st.st_mode);
2536
- }
2537
-
2538
2532
inline bool is_valid_path(const std::string &path) {
2539
2533
size_t level = 0;
2540
2534
size_t i = 0;
@@ -2577,6 +2571,16 @@ inline bool is_valid_path(const std::string &path) {
2577
2571
return true;
2578
2572
}
2579
2573
2574
+ inline bool is_file(const std::string &path) {
2575
+ struct stat st;
2576
+ return stat(path.c_str(), &st) >= 0 && S_ISREG(st.st_mode);
2577
+ }
2578
+
2579
+ inline bool is_dir(const std::string &path) {
2580
+ struct stat st;
2581
+ return stat(path.c_str(), &st) >= 0 && S_ISDIR(st.st_mode);
2582
+ }
2583
+
2580
2584
inline std::string encode_query_param(const std::string &value) {
2581
2585
std::ostringstream escaped;
2582
2586
escaped.fill('0');
Original file line number Diff line number Diff line change @@ -7563,8 +7563,8 @@ TEST(UniversalClientImplTest, Ipv6LiteralAddress) {
7563
7563
}
7564
7564
7565
7565
TEST (FileSystemTest, FileAndDirExistenceCheck) {
7566
- std::string file_path = " ./www/dir/index.html" ;
7567
- std::string dir_path = " ./www/dir" ;
7566
+ auto file_path = " ./www/dir/index.html" ;
7567
+ auto dir_path = " ./www/dir" ;
7568
7568
7569
7569
EXPECT_TRUE (detail::is_file (file_path));
7570
7570
EXPECT_FALSE (detail::is_dir (file_path));
You can’t perform that action at this time.
0 commit comments