get rid of read to str
This commit is contained in:
@@ -59,15 +59,7 @@ ssize_t readFile(std::string path, char* buffer, size_t maxlen) {
|
||||
return readFile(path.c_str(), buffer, maxlen);
|
||||
}
|
||||
|
||||
std::string readFileToStr(std::string path, size_t trim) {
|
||||
char* buf = new char[trim + 2];
|
||||
ssize_t len = readFile(path, buf, trim + 2);
|
||||
std::string out(buf);
|
||||
delete[] buf;
|
||||
if (!len) return "0";
|
||||
return out.substr(0, len - 1);
|
||||
}
|
||||
|
||||
/* finds first dir in path and returns it*/
|
||||
std::string getFirstDir(std::string_view path) {
|
||||
for (const auto& entry : std::filesystem::directory_iterator(path))
|
||||
return entry.path();
|
||||
|
||||
Reference in New Issue
Block a user