mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-11 05:56:57 +03:00
Rolling 20220910
This commit is contained in:
@@ -706,7 +706,7 @@ void delete_all_in_directory(std::string _directory)
|
|||||||
closedir(dir);
|
closedir(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::string _target_bin)
|
std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::string _target_bin, std::string _main)
|
||||||
{
|
{
|
||||||
int i, sort_iter;
|
int i, sort_iter;
|
||||||
mz_bool status;
|
mz_bool status;
|
||||||
@@ -760,14 +760,24 @@ std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::st
|
|||||||
|
|
||||||
// Save to File.
|
// Save to File.
|
||||||
zw = std::string(archive_filename);
|
zw = std::string(archive_filename);
|
||||||
if (toUpper(getFileType(zw)) == "BIN")
|
if (toUpper(zw) == "FIRMWARE.BIN")
|
||||||
{
|
{
|
||||||
zw = _target_bin + zw;
|
zw = _target_bin + zw;
|
||||||
ret = zw;
|
ret = zw;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
zw = _target_zip + zw;
|
std::string _dir = getDirectory(zw);
|
||||||
|
|
||||||
|
if (_dir.length() > 0)
|
||||||
|
{
|
||||||
|
zw = _main + zw;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
zw = _target_zip + zw;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Filename to extract: %s", zw.c_str());
|
printf("Filename to extract: %s", zw.c_str());
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
void register_server_file_uri(httpd_handle_t server, const char *base_path);
|
void register_server_file_uri(httpd_handle_t server, const char *base_path);
|
||||||
|
|
||||||
void unzip(std::string _in_zip_file, std::string _target_directory);
|
void unzip(std::string _in_zip_file, std::string _target_directory);
|
||||||
std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::string _target_bin);
|
std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::string _target_bin, std::string _main = "/sdcard/");
|
||||||
|
|
||||||
|
|
||||||
void delete_all_in_directory(std::string _directory);
|
void delete_all_in_directory(std::string _directory);
|
||||||
|
|||||||
@@ -268,14 +268,26 @@ string getFileFullFileName(string filename)
|
|||||||
if (lastpos == string::npos)
|
if (lastpos == string::npos)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
printf("Last position: %d\n", lastpos);
|
// printf("Last position: %d\n", lastpos);
|
||||||
|
|
||||||
string zw = filename.substr(lastpos + 1, filename.size() - lastpos);
|
string zw = filename.substr(lastpos + 1, filename.size() - lastpos);
|
||||||
// zw = toUpper(zw);
|
|
||||||
|
|
||||||
return zw;
|
return zw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string getDirectory(string filename)
|
||||||
|
{
|
||||||
|
size_t lastpos = filename.find('/');
|
||||||
|
|
||||||
|
if (lastpos == string::npos)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
// printf("Directory: %d\n", lastpos);
|
||||||
|
|
||||||
|
string zw = filename.substr(0, lastpos - 1);
|
||||||
|
return zw;
|
||||||
|
}
|
||||||
|
|
||||||
string getFileType(string filename)
|
string getFileType(string filename)
|
||||||
{
|
{
|
||||||
size_t lastpos = filename.find(".", 0);
|
size_t lastpos = filename.find(".", 0);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ bool ctype_space(const char c, string adddelimiter);
|
|||||||
|
|
||||||
string getFileType(string filename);
|
string getFileType(string filename);
|
||||||
string getFileFullFileName(string filename);
|
string getFileFullFileName(string filename);
|
||||||
|
string getDirectory(string filename);
|
||||||
|
|
||||||
int mkdir_r(const char *dir, const mode_t mode);
|
int mkdir_r(const char *dir, const mode_t mode);
|
||||||
int removeFolder(const char* folderPath, const char* logTag);
|
int removeFolder(const char* folderPath, const char* logTag);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const char* GIT_REV="N/A";
|
const char* GIT_REV="N/A";
|
||||||
const char* GIT_TAG="N/A";
|
const char* GIT_TAG="N/A";
|
||||||
const char* GIT_BRANCH="N/A";
|
const char* GIT_BRANCH="N/A";
|
||||||
const char* BUILD_TIME="2022-09-10 20:27";
|
const char* BUILD_TIME="2022-09-10 23:06";
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
const char* GIT_REV="N/A";
|
const char* GIT_REV="N/A";
|
||||||
const char* GIT_TAG="N/A";
|
const char* GIT_TAG="N/A";
|
||||||
const char* GIT_BRANCH="N/A";
|
const char* GIT_BRANCH="N/A";
|
||||||
const char* BUILD_TIME="2022-09-10 20:27";
|
const char* BUILD_TIME="2022-09-10 23:06";
|
||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user