Compares two paths, based on ignored case and with standardized path separators. Returns true if the paths match; false otherwise.
| 67 | // Compares two paths, based on ignored case and with standardized path separators. |
| 68 | // Returns true if the paths match; false otherwise. |
| 69 | bool RgaSharedUtils::ComparePaths(const std::string& path1, const std::string& path2) |
| 70 | { |
| 71 | std::string p1_lower = path1; |
| 72 | std::string p2_lower = path2; |
| 73 | |
| 74 | // Make both paths lowercase and with forward slashes. |
| 75 | std::transform(p1_lower.begin(), p1_lower.end(), p1_lower.begin(), [](unsigned char c) { return static_cast<unsigned char>((c == '\\') ? '/' : std::tolower(c)); }); |
| 76 | std::transform(p2_lower.begin(), p2_lower.end(), p2_lower.begin(), [](unsigned char c) { return static_cast<unsigned char>((c == '\\') ? '/' : std::tolower(c)); }); |
| 77 | |
| 78 | return (p1_lower == p2_lower); |
| 79 | } |
| 80 | |
| 81 | // Get current system time. |
| 82 | static bool CurrentTime(struct tm& time_data) |