This commit is contained in:
mrbesen 2020-12-10 21:09:20 +01:00
parent 630ca77b98
commit f1c5641ed0
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
3 changed files with 13 additions and 0 deletions

View File

@ -36,4 +36,6 @@ bool readFile(int fd, std::ostream& output, unsigned int maxsize = 0);
bool copy(int fd_from, int fd_to);
bool copy(const std::string& from, const std::string& to);
std::string realPath(const std::string& str);
}

View File

@ -145,3 +145,11 @@ bool mrbesen::files::copy(const std::string& from, const std::string& to) {
return r;
}
std::string mrbesen::files::realPath(const std::string& str) {
char buffer[PATH_MAX];
char* ret = ::realpath(str.c_str(), buffer);
if(ret == nullptr) return "";
return std::string(buffer);
}

View File

@ -23,6 +23,7 @@ int testUtil_equalsIgnoreCase() {
std::string a = "abcdefg";
std::string b = "AbCdEHI";
std::string c = "AbCdEHIJ";
std::string d = "aBcDeFg";
ASSERT(!equalsIgnoreCase(a, b), "");
ASSERT(!equalsIgnoreCase(a, b, 10000), "");
@ -36,6 +37,8 @@ int testUtil_equalsIgnoreCase() {
ASSERT(!equalsIgnoreCase(a, c, 8), "");
ASSERT(equalsIgnoreCase(a, c, 5), "");
ASSERT(equalsIgnoreCase(a, d), "");
return TESTGOOD;
}