Rollling 20220910

This commit is contained in:
jomjol
2022-09-10 20:19:31 +02:00
parent 3403e3ea5c
commit 79d1e6b932
13 changed files with 213 additions and 40 deletions

View File

@@ -209,6 +209,13 @@ size_t findDelimiterPos(string input, string delimiter)
return pos;
}
void DeleteFile(string fn)
{
// ESP_LOGI(logTag, "Deleting file : %s", fn.c_str());
/* Delete file */
unlink(fn.c_str());
}
void CopyFile(string input, string output)
{
@@ -245,16 +252,31 @@ void CopyFile(string input, string output)
fclose(fpTargetFile);
}
string getFileFullFileName(string filename)
{
size_t lastpos = filename.find_last_of("/", 0);
if (lastpos == string::npos)
return "";
string zw = filename.substr(lastpos + 1, filename.size() - lastpos);
zw = toUpper(zw);
return zw;
}
string getFileType(string filename)
{
int lastpos = filename.find(".", 0);
int neu_pos;
size_t lastpos = filename.find(".", 0);
size_t neu_pos;
while ((neu_pos = filename.find(".", lastpos + 1)) > -1)
{
lastpos = neu_pos;
}
if (lastpos == string::npos)
return "";
string zw = filename.substr(lastpos + 1, filename.size() - lastpos);
zw = toUpper(zw);

View File

@@ -10,6 +10,7 @@ std::string FormatFileName(std::string input);
void FindReplace(std::string& line, std::string& oldString, std::string& newString);
void CopyFile(string input, string output);
void DeleteFile(string fn);
FILE* OpenFileAndWait(const char* nm, const char* _mode, int _waitsec = 1);
@@ -19,6 +20,7 @@ string trim(string istring, string adddelimiter = "");
bool ctype_space(const char c, string adddelimiter);
string getFileType(string filename);
string getFileFullFileName(string filename);
int mkdir_r(const char *dir, const mode_t mode);
int removeFolder(const char* folderPath, const char* logTag);