upgrade core add header check and incrace upload speed
This commit is contained in:
+18
-18
@@ -10,7 +10,7 @@ DataTransfer::DataTransfer(const std::string& tr)
|
||||
void DataTransfer::Init(const std::string& tr)
|
||||
{
|
||||
temp_root = tr;
|
||||
SCLOG_DEBUG("GDT-TempRoot: %s", temp_root.c_str());
|
||||
SCLOGF_DEBUG("GDT-TempRoot: {}", temp_root);
|
||||
}
|
||||
|
||||
bool DataTransfer::ItemExist(const std::string& file)
|
||||
@@ -23,7 +23,7 @@ bool DataTransfer::InsertItem(const std::string& file)
|
||||
if (ItemExist(file))
|
||||
return false;
|
||||
files.insert({ file, true });
|
||||
SCLOG_INFO("GDT: Item [%s] Inserted", file.c_str());
|
||||
SCLOGF_INFO("GDT: Item [{}] Inserted", file);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ bool DataTransfer::RemoveItem(const std::string& file)
|
||||
if (!ItemExist(file))
|
||||
return false;
|
||||
files.erase(file);
|
||||
SCLOG_INFO("GDT: Item [%s] Removed", file.c_str());
|
||||
SCLOGF_INFO("GDT: Item [{}] Removed", file);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ void DataTransfer::DeactivateItem(const std::string& file)
|
||||
if (!ItemExist(file))
|
||||
return;
|
||||
files[file] = false;
|
||||
SCLOG_INFO("GDT: Item [%s] Deactivated", file.c_str());
|
||||
SCLOGF_INFO("GDT: Item [{}] Deactivated", file);
|
||||
}
|
||||
|
||||
bool DataTransfer::CopyItemTo(const std::string& file, const std::string& dest_path)
|
||||
@@ -59,19 +59,19 @@ bool DataTransfer::CopyItemTo(const std::string& file, const std::string& dest_p
|
||||
std::error_code error;
|
||||
if(!fs::exists(dest_path))
|
||||
{
|
||||
SCLOG_ERROR("GDT: Can't Copy File (Target Path [%s] Not Exist)", dest_path.c_str());
|
||||
SCLOGF_ERROR("GDT: Can't Copy File (Target Path [{}] Not Exist)", dest_path);
|
||||
return false;
|
||||
}
|
||||
fs::path dest(dest_path);
|
||||
fs::path dest_file = dest / file;
|
||||
if(fs::copy_file(MakePath(file), dest_file, fs::copy_options::overwrite_existing, error))
|
||||
{
|
||||
SCLOG_INFO("GDT: File Copied To [%s]", dest_file.c_str());
|
||||
SCLOGF_INFO("GDT: File Copied To [{}]", dest_file);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
SCLOG_ERROR("Failed To Delete File [%s], Error: %s (%d)", dest_file.c_str(), error.message().c_str(), error.value());
|
||||
SCLOGF_ERROR("Failed To Delete File [{}], Error: {} ({})", dest_file, error.message(), error.value());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -85,12 +85,12 @@ bool DataTransfer::CopyItemAS(const std::string& file, const std::string& dest)
|
||||
fs::path dest_file = dest;
|
||||
if(fs::copy_file(MakePath(file), dest_file, fs::copy_options::overwrite_existing, error))
|
||||
{
|
||||
SCLOG_INFO("GDT: File Copied To [%s]", dest_file.c_str());
|
||||
SCLOGF_INFO("GDT: File Copied To [{}]", dest_file);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
SCLOG_ERROR("Failed To Delete File [%s], Error: %s (%d)", dest_file.c_str(), error.message().c_str(), error.value());
|
||||
SCLOGF_ERROR("Failed To Delete File [{}], Error: {} ({})", dest_file, error.message(), error.value());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -111,14 +111,14 @@ bool DataTransfer::RemoveAllCacheFiles()
|
||||
std::string filepath = MakePath(file);
|
||||
if (!fs::exists(filepath, error))
|
||||
{
|
||||
SCLOG_WARNING("File [%s] Not Exist, Skip", filepath.c_str());
|
||||
SCLOGF_WARNING("File [{}] Not Exist, Skip", filepath);
|
||||
continue;
|
||||
}
|
||||
if (fs::remove(filepath, error))
|
||||
SCLOG_INFO("File [%s] Deleted", filepath.c_str());
|
||||
SCLOGF_INFO("File [{}] Deleted", filepath);
|
||||
else
|
||||
{
|
||||
SCLOG_ERROR("Failed To Delete File [%s], Error: %s (%d)", filepath.c_str(), error.message().c_str(), error.value());
|
||||
SCLOGF_ERROR("Failed To Delete File [{}], Error: {} ({})", filepath, error.message(), error.value());
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
@@ -137,14 +137,14 @@ fs_scan:
|
||||
if (fs::remove_all(entry.path(), error))
|
||||
{
|
||||
dirs_deleted++;
|
||||
SCLOG_WARNING("Found Directory [%s] In Cache Directory, Deleted", entry.path().string().c_str());
|
||||
SCLOGF_WARNING("Found Directory [{}] In Cache Directory, Deleted", entry.path().string());
|
||||
}
|
||||
else
|
||||
SCLOG_ERROR("Found Directory [%s] In Cache Directory, Failed To Delete. Error: %s (%d)", entry.path().string().c_str(), error.message().c_str(), error.value());
|
||||
SCLOGF_ERROR("Found Directory [{}] In Cache Directory, Failed To Delete. Error: {} ({})", entry.path().string(), error.message(), error.value());
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
SCLOG_ERROR("Found Directory [%s] In Cache Directory, Failed To Delete. Exception: %s", entry.path().string().c_str(), e.what());
|
||||
SCLOGF_ERROR("Found Directory [{}] In Cache Directory, Failed To Delete. Exception: {}", entry.path().string(), e.what());
|
||||
}
|
||||
}
|
||||
else if (entry.is_regular_file())
|
||||
@@ -153,16 +153,16 @@ fs_scan:
|
||||
if (fs::remove(entry.path(), error))
|
||||
{
|
||||
files_deleted++;
|
||||
SCLOG_INFO("File [%s] Deleted", entry.path().string().c_str());
|
||||
SCLOGF_INFO("File [{}] Deleted", entry.path().string());
|
||||
}
|
||||
else
|
||||
{
|
||||
SCLOG_ERROR("Failed To Delete File [%s], Error: %s (%d)", entry.path().string().c_str(), error.message().c_str(), error.value());
|
||||
SCLOGF_ERROR("Failed To Delete File [{}], Error: {} ({})", entry.path().string(), error.message(), error.value());
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
SCLOG_INFO("Filesystem Scan Finished, %d/%d Dir(s) And %d/%d Files(s) Deleted", dirs_deleted, dirs, files_deleted, files);
|
||||
SCLOGF_INFO("Filesystem Scan Finished, {}/{} Dir(s) And {}/{} Files(s) Deleted", dirs_deleted, dirs, files_deleted, files);
|
||||
SCLOG_INFO("Cache Clear Finished");
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user