9#ifndef _AUROSTD_XFILE_CPP_
10#define _AUROSTD_XFILE_CPP_
28#include <archive_entry.h>
53 if (!std::filesystem::is_directory(directory)) {
54 return std::filesystem::create_directories(directory);
63 [[deprecated(
"Should be rewritten without using system calls")]]
64 bool SSH_DirectoryMake(
const string& user,
const string& machine,
const string& directory_raw) {
65 const bool LDEBUG = (
false ||
XHOST.DEBUG);
67 std::deque<string> tokens;
71 if (Directory.at(0) ==
'/') {
72 tokens[0] =
"/" + tokens[0];
74 for (
const auto& token : tokens) {
75 dir_tmp += token +
"/";
76 command =
"ssh " + user +
"@" + machine +
" mkdir \"" + dir_tmp +
"\"";
78 cerr <<
"SSH_DirectoryMake creating directory=" << command << endl;
94 if (directory.empty()) {
98 vsubd.push_back(directory);
99 for (
const std::filesystem::directory_entry& dir_entry : std::filesystem::directory_iterator(directory)) {
100 if (dir_entry.is_directory()) {
101 vsubd.push_back(dir_entry.path().filename().string());
114 bool DirectoryLS(
const string& directory_raw, vector<string>& vfiles) {
116 if (directory.empty()) {
120 for (
const std::filesystem::directory_entry& dir_entry : std::filesystem::directory_iterator(directory)) {
121 vfiles.push_back(dir_entry.path().filename().string());
126 bool DirectoryLS(
const string& directory_raw, deque<string>& vfiles) {
127 vector<string> _vfiles;
160 return std::filesystem::path(FileName).extension().string();
171 const bool LDEBUG = (
false ||
XHOST.DEBUG);
172 if (fileIN.empty()) {
182 for (
const char c : fileIN) {
187 if (fileOUT.find(
'~') != string::npos) {
191 while (fileOUT.find(
"//") != string::npos) {
217 if (
FileExist(directory +
"/" + LOCK +
".xz")) {
220 if (
FileExist(directory +
"/" + LOCK +
".gz")) {
223 if (
FileExist(directory +
"/" + LOCK +
".bz2")) {
244 if (
FileExist(directory +
"/SKIP.bz2")) {
281 const std::filesystem::path path(FileNameIn);
283 archive_entry* entry;
288 a = archive_read_new();
289 if (path.extension() ==
".zip") {
290 archive_read_support_format_zip(a);
292 archive_read_support_format_raw(a);
293 archive_read_support_format_empty(a);
294 archive_read_support_filter_all(a);
298 r = archive_read_open_filename(a, FileNameIn.c_str(), 16384);
299 if (r != ARCHIVE_OK) {
305 archive_read_next_header(a, &entry);
306 if ((
static_cast<std::string
>(archive_filter_name(a, r)) ==
"none") && (
static_cast<std::string
>(archive_format_name(a)) ==
"raw")) {
310 archive_read_free(a);
321 const std::filesystem::path path(FileNameIn);
322 FileNameOut = path.parent_path().string() +
"/" + path.stem().string();
335 }
catch (std::filesystem::filesystem_error& e) {
345 bool FileExist(
const string& FileName,
string& FileNameOut) {
347 FileNameOut = FileName;
368 FileNameOut = FileName;
372 FileNameOut = FileName +
".xz";
376 FileNameOut = FileName +
".bz2";
380 FileNameOut = FileName +
".gz";
384 FileNameOut = FileName +
".zip";
411 for (
const string& entry : list) {
413 if (entry == input + suffix) {
414 output = input + suffix;
432 ifstream FileStream(FileName);
433 return (FileStream.peek() == ifstream::traits_type::eof());
452 struct stat file_stat{};
453 if (stat(FileName.c_str(), &file_stat) == 0) {
454 tm = file_stat.st_mtime;
456 return static_cast<long int>(tm);
481 return max(
static_cast<long int>(0), tmod_tmp - tmod_file);
492 unsigned long long int FileSize(
const string& FileName) {
500 void InFileExistCheck(
const string& routine,
const string& FileNameRaw,
const ifstream& file_to_check) {
502 if (!file_to_check) {
503 const string message =
"In routine " + routine +
". Cannot open file " + FileName +
".";
515 string TmpStrCreate(
const string& identifier_raw,
const string& tmpdir_raw,
const bool hidden,
const bool directory) {
516 string identifier = identifier_raw;
517 if (identifier.empty()) {
520 string tmpdir = tmpdir_raw;
521 if (tmpdir.empty()) {
522 tmpdir =
XHOST.tmpfs;
524 string str = tmpdir +
"/" + (hidden ?
"." :
"") +
"_aflow_" + identifier +
"." +
XHOST.user +
".pid" +
XHOST.ostrPID.str() +
".tid" +
XHOST.ostrTID.str() +
".a" + AFLOW_VERSION +
533 string TmpFileCreate(
const string& identifier,
const string& tmpdir,
const bool hidden) {
542 string dir =
TmpStrCreate(identifier, tmpdir, hidden,
true);
555 bool CopyFile(
const string& file_from,
const string& file_to) {
556 const std::filesystem::path from_path =
CleanFileName(file_from);
557 const std::filesystem::path to_path =
CleanFileName(file_to);
559 if (!std::filesystem::is_regular_file(from_path)) {
562 if (std::filesystem::is_regular_file(to_path)) {
563 if (std::filesystem::equivalent(from_path, to_path)) {
567 return std::filesystem::copy_file(from_path, to_path, std::filesystem::copy_options::overwrite_existing);
578 bool LinkFile(
const string& file_from,
const string& file_to,
const bool soft) {
581 const std::filesystem::path from_path = from_clean;
582 const std::filesystem::path to_path = to_clean;
583 if (from_path.empty() || to_path.empty() || !std::filesystem::exists(from_path) || std::filesystem::exists(to_path) || !std::filesystem::exists(to_path.parent_path())) {
587 std::filesystem::create_symlink(from_clean, to_clean);
588 return std::filesystem::is_symlink(to_clean);
590 std::filesystem::create_hard_link(from_clean, to_clean);
591 return std::filesystem::is_regular_file(to_clean);
603 const std::filesystem::path dir_path =
CleanFileName(destination);
604 if (!std::filesystem::is_regular_file(old_path)) {
607 if (!std::filesystem::is_directory(dir_path)) {
611 std::filesystem::rename(old_path, dir_path / old_path.filename());
612 }
catch (std::filesystem::filesystem_error& e) {
613 std::filesystem::copy(old_path, dir_path / old_path.filename(), std::filesystem::copy_options::overwrite_existing);
614 std::filesystem::remove(old_path);
623 for (
const auto& file : files) {
639 bool file2file(
const string& file,
const string& destination) {
641 const std::filesystem::path new_path =
CleanFileName(destination);
642 if (!std::filesystem::is_regular_file(old_path)) {
646 std::filesystem::rename(old_path, new_path);
647 }
catch (std::filesystem::filesystem_error& e) {
648 std::filesystem::copy(old_path, new_path, std::filesystem::copy_options::overwrite_existing);
649 std::filesystem::remove(old_path);
662 if (std::filesystem::is_regular_file(path)) {
663 return std::filesystem::remove(path);
674 bool RemoveFile(
const string& directory,
const std::regex& regex_pattern) {
676 for (
const std::filesystem::directory_entry& dir_entry : std::filesystem::directory_iterator(std::filesystem::path(
aurostd::CleanFileName(directory)))) {
677 if (dir_entry.is_regular_file() && std::regex_match(dir_entry.path().filename().string(), regex_pattern)) {
678 std::filesystem::remove(dir_entry.path());
690 if (dir_entry.is_regular_file()) {
691 std::filesystem::remove(dir_entry.path());
701 for (
const auto& file : files) {
717 if (std::filesystem::is_directory(path)) {
718 std::filesystem::remove_all(path);
743 const std::ifstream open_file(FileNameINClean);
744 std::stringstream buffer;
745 buffer << open_file.rdbuf();
746 StringIN = buffer.str();
747 return StringIN.length();
765 std::stringstream ss;
768 return content.length();
779 size_t file2vectorstring(
const string& FileNameIN, vector<string>& vline,
bool consecutive,
bool trim_edges) {
807 const std::ifstream open_file(FileNameINClean);
808 StringstreamIN << open_file.rdbuf();
820 static constexpr size_t buff_len = 16384;
821 thread_local char buff[buff_len + 1];
822 archive* a = archive_read_new();
823 archive_entry* entry;
828 archive_read_support_format_zip(a);
830 archive_read_support_format_raw(a);
831 archive_read_support_format_empty(a);
832 archive_read_support_filter_all(a);
836 if (
const int r = archive_read_open_filename(a, file.c_str(), buff_len); r != ARCHIVE_OK) {
837 const std::string message =
"Problem loading output: ";
840 archive_read_next_header(a, &entry);
844 size_t len = archive_read_data(a,
buff, buff_len);
848 len = archive_read_data(a,
buff, buff_len);
852 archive_read_free(a);
866 const fs::path FileNameOUTPUT =
CleanFileName(FileNameRawOUTPUT);
868 fs::create_directories(fs::absolute(FileNameOUTPUT).parent_path());
869 }
catch (fs::filesystem_error& e) {
872 bool writable =
true;
874 if (
mode ==
"POST" ||
mode ==
"APPEND" ||
mode ==
"PRE") {
876 if (fs::exists(FileNameOUTPUT)) {
880 if (
mode ==
"POST" ||
mode ==
"APPEND") {
886 FileOUTPUT.open(FileNameOUTPUT.c_str(), std::ios::out);
887 writable = FileOUTPUT.is_open();
888 if (
mode ==
"POST" ||
mode ==
"APPEND") {
889 FileOUTPUT << FileINPUT;
891 FileOUTPUT << StringOUTPUT;
893 FileOUTPUT << FileINPUT;
901 if (
mode ==
"WRITE" ||
mode.empty()) {
906 FileOUTPUT.open(FileNameOUTPUT.c_str(), std::ios::out);
907 writable = FileOUTPUT.is_open();
908 FileOUTPUT << StringOUTPUT;
928 fs::create_directories(fs::absolute(file).parent_path());
929 }
catch (fs::filesystem_error& e) {
934 archive_entry* entry;
938 a = archive_write_new();
939 entry = archive_entry_new();
949 r = archive_write_open_filename(a, file.c_str());
950 if (r != ARCHIVE_OK) {
951 const std::string message =
"Problem preparing output: ";
956 archive_entry_set_pathname(entry, file.c_str());
957 archive_entry_set_size(entry, content.size());
958 archive_entry_set_filetype(entry, AE_IFREG);
961 archive_write_header(a, entry);
964 archive_write_data(a, content.c_str(), content.size());
967 archive_entry_free(entry);
968 archive_write_close(a);
969 archive_write_free(a);
975 return string2file(StringstreamOUTPUT.str(), FileNameOUTPUT, ct,
mode);
1002 fs::create_directories(fs::absolute(file).parent_path());
1003 }
catch (fs::filesystem_error& e) {
1008 std::stringstream full_string;
1009 for (
const auto& iline : vline) {
1010 full_string << iline << endl;
1015 FileOUT.open(file.c_str(), std::ios::out);
1016 const bool writable = FileOUT.is_open();
1017 for (
const auto& iline : vline) {
1018 FileOUT << iline << endl;
1030 if (r != ARCHIVE_OK) {
1031 if (r == ARCHIVE_WARN) {
1032 const string full_message =
"LibArchive Warning during " + message +
": ";
1034 cerr << full_message << archive_error_string(a) <<
" (not a fatal error)" << endl;
1037 const string full_message =
"LibArchive Error during " + message +
": ";
1052 const std::string error_message =
"initialization";
1056 r = archive_write_set_format_raw(a);
1058 r = archive_write_set_format_pax_restricted(a);
1061 r = archive_write_add_filter_bzip2(a);
1063 r = archive_write_set_options(a,
"compression-level=9");
1068 r = archive_write_set_format_raw(a);
1070 r = archive_write_set_format_pax_restricted(a);
1073 r = archive_write_add_filter_gzip(a);
1075 r = archive_write_set_options(a,
"compression-level=9");
1080 r = archive_write_set_format_raw(a);
1082 r = archive_write_set_format_pax_restricted(a);
1085 r = archive_write_add_filter_xz(a);
1087 r = archive_write_set_options(a,
"compression-level=9,threads=1");
1091 r = archive_write_set_format_zip(a);
1094 r = archive_write_set_options(a,
"compression=deflate,zip64");
1096 r = archive_write_set_options(a,
"compression=store,zip64");
1102 r = archive_write_set_format_raw(a);
1104 r = archive_write_set_format_pax_restricted(a);
1107 r = archive_write_add_filter_zstd(a);
1109 r = archive_write_set_options(a,
"compression-level=20");
1123 void DecompressFile(
const string& file_raw,
const string& outfile_raw,
const bool keep) {
1126 const std::filesystem::path path(file);
1127 thread_local char buff[16384];
1129 archive_entry* entry;
1132 const std::string error_message =
"decompression of a single file";
1135 a = archive_read_new();
1136 if (path.extension() ==
".zip") {
1137 r = archive_read_support_format_zip(a);
1140 r = archive_read_support_format_raw(a);
1142 r = archive_read_support_format_empty(a);
1144 r = archive_read_support_filter_all(a);
1149 r = archive_read_open_filename(a, file.c_str(),
sizeof(
buff));
1151 if (outfile.empty()) {
1152 outfile = path.parent_path().string() +
"/" + path.stem().string();
1154 r = archive_read_next_header(a, &entry);
1155 if (r == ARCHIVE_EOF) {
1156 std::fstream fs(outfile, std::ios::out);
1161 std::fstream fs(outfile, std::ios::out);
1162 len = archive_read_data(a,
buff,
sizeof(
buff));
1164 fs.write(
buff, len);
1165 len = archive_read_data(a,
buff,
sizeof(
buff));
1174 r = archive_read_free(a);
1188 void DecompressFiles(
const string& archive_file,
const string& directory,
const bool keep) {
1191 std::filesystem::path path(archive_file_clean);
1192 thread_local char buff[16384];
1194 archive_entry* entry;
1197 const std::string error_message =
"decompression of multiple files";
1200 a = archive_read_new();
1201 if (path.extension() ==
".zip") {
1202 r = archive_read_support_format_zip(a);
1205 r = archive_read_support_format_tar(a);
1207 r = archive_read_support_filter_all(a);
1212 r = archive_read_open_filename(a, archive_file_clean.c_str(),
sizeof(
buff));
1216 if (directory_clean.empty()) {
1219 while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
1220 if ((
static_cast<std::string
>(archive_filter_name(a, r)) ==
"none") && (
static_cast<std::string
>(archive_format_name(a)) ==
"raw")) {
1223 path = std::filesystem::path(directory_clean +
"/" + archive_entry_pathname(entry));
1224 if (!std::filesystem::is_directory(path.parent_path())) {
1225 std::filesystem::create_directories(path.parent_path());
1227 std::fstream fs(path.string(), std::ios::out);
1228 len = archive_read_data(a,
buff,
sizeof(
buff));
1230 fs.write(
buff, len);
1231 len = archive_read_data(a,
buff,
sizeof(
buff));
1240 r = archive_read_free(a);
1258 thread_local char buff[16384];
1261 archive_entry* entry;
1263 const std::string error_message =
"compression of a single file";
1266 a = archive_write_new();
1267 entry = archive_entry_new();
1268 disk = archive_read_disk_new();
1269 r = archive_read_disk_set_standard_lookup(disk);
1276 r = archive_read_disk_open(disk, file.c_str());
1280 fs::path outfile = file;
1281 outfile.replace_extension(
static_cast<string>(file.extension()) +
compression_suffix[ct]);
1283 r = archive_write_open_filename(a, outfile.c_str());
1287 r = archive_read_next_header2(disk, entry);
1289 r = archive_read_disk_descend(disk);
1293 r = archive_write_header(a, entry);
1297 std::ifstream is(archive_entry_sourcepath(entry), std::ifstream::binary);
1300 archive_write_data(a,
buff, is.gcount());
1308 archive_entry_free(entry);
1309 r = archive_read_free(disk);
1311 r = archive_write_free(a);
1324 fs::path
CompressFiles(
const vector<string>& files_raw,
const fs::path& relative_to_path,
const string& archive_name,
const compression_type ct,
const bool keep) {
1325 thread_local char buff[16384];
1328 archive_entry* entry;
1330 const std::string error_message =
"compression of multiple files";
1331 vector<string> files;
1332 files.reserve(files_raw.size());
1333 for (
const auto& f : files_raw) {
1338 a = archive_write_new();
1344 string tar_suffix =
".tar";
1350 fs::create_directories(fs::absolute(outfile).parent_path());
1351 }
catch (fs::filesystem_error& e) {
1352 const string error = e.what();
1353 const string message =
"Parent folder could not be created: " +
static_cast<string>(outfile.parent_path()) +
"\n" + error;
1357 r = archive_write_open_filename(a, outfile.c_str());
1360 for (
const auto& file : files) {
1362 entry = archive_entry_new();
1365 disk = archive_read_disk_new();
1366 r = archive_read_disk_set_standard_lookup(disk);
1370 r = archive_read_disk_open(disk, file.c_str());
1374 r = archive_read_next_header2(disk, entry);
1376 r = archive_read_disk_descend(disk);
1380 const std::string original_path_raw = archive_entry_pathname(entry);
1381 const fs::path original_path(original_path_raw);
1383 const fs::path new_path = fs::proximate(original_path, relative_to_path);
1384 const std::string new_path_raw = new_path.string();
1385 archive_entry_set_pathname(entry, new_path_raw.c_str());
1388 r = archive_write_header(a, entry);
1392 std::ifstream is(archive_entry_sourcepath(entry), std::ifstream::binary);
1395 archive_write_data(a,
buff, is.gcount());
1403 archive_entry_free(entry);
1404 r = archive_read_free(disk);
1409 r = archive_write_close(a);
1411 r = archive_write_free(a);
1448 bool tempfile_created =
false;
1455 tempfile_created =
false;
1460 FileNameOUT = FileNameIN;
1463 tempfile_created =
true;
1476 const std::filesystem::path path(file);
1477 thread_local char buff[16384];
1480 archive_entry* entry;
1483 const std::string error_message =
"re-compressing of a single file";
1486 a = archive_read_new();
1487 if (path.extension() ==
".zip") {
1488 r = archive_read_support_format_zip(a);
1491 r = archive_read_support_format_raw(a);
1493 r = archive_read_support_format_empty(a);
1495 r = archive_read_support_filter_all(a);
1498 a_new = archive_write_new();
1504 r = archive_read_open_filename(a, file.c_str(),
sizeof(
buff));
1506 r = archive_read_next_header(a, &entry);
1510 const string outfile = path.parent_path().string() +
"/" + path.stem().string() +
compression_suffix[ct];
1511 r = archive_write_open_filename(a_new, outfile.c_str());
1515 r = archive_write_header(a_new, entry);
1519 len = archive_read_data(a,
buff,
sizeof(
buff));
1521 archive_write_data(a_new,
buff, len);
1522 len = archive_read_data(a,
buff,
sizeof(
buff));
1529 r = archive_write_free(a_new);
1531 r = archive_write_free(a);
1543 if (directory_clean.empty()) {
1547 string ext = ext_new;
1548 for (
const std::filesystem::directory_entry& dir_entry : std::filesystem::directory_iterator(directory_clean)) {
1549 ext = dir_entry.path().extension().string();
1550 if ((ext ==
".bz2" || ext ==
".gz" || ext ==
".xz" || ext ==
".zip" || ext ==
".zstd") && (ext != ext_new)) {
#define _LOCK_LINK_SUFFIX_
string basename(const string &file)
returns the basename of file
bool string2file(const string &StringOUTPUT, const std::string &FileNameRawOUTPUT, const compression_type ct, const string &mode)
write string into a file
void CompressFile(const string &file_raw, const compression_type ct, const bool keep)
compress file
bool vectorstring2file(const vtype< string > &vline, const string &FileNameOUT, const compression_type ct)
write a list of strings to file
bool DirectoryLS(const string &directory_raw, vector< string > &vfiles)
returns the content of a directory
bool RemoveDirectory(const string &directory)
remove a file
unsigned long long int FileSize(const string &FileName)
returns in bytes the size of a file
bool RemoveFiles(const string &directory)
removes all regular files inside a directory, not recursive
bool file2directory(const string &file, const string &destination)
move file to directory
void StringSubstInPlace(string &work_string, const string &old_string, const string &new_string)
substitute parts of a strings in place
string TmpFileCreate(const string &identifier, const string &tmpdir, const bool hidden)
create a string pointing to the location of a unique temp file
long int SecondsSinceFileModified(const string &FileNameRaw)
gets duration since file modification
long int GetTimestampModified(const string &FileNameRaw)
gets modification time
bool stringstream2compressfile(const stringstream &content, const string &file, const compression_type ct)
stringstream to compressed file
const std::vector< std::string > compression_suffix
void compressfiles2compressfiles(const string &directory, const compression_type ct, const bool keep)
convert compressed files in a directory to another compression
long double get_useconds()
string TmpStrCreate(const string &identifier_raw, const string &tmpdir_raw, const bool hidden, const bool directory)
create a string pointing to the location of a unique temp file or directory
deque< utype > vector2deque(const vector< utype > &vin)
void compressfile2compressfile(const string &file, const compression_type ct, const bool keep)
convert a compressed file to another compression
bool CompressFileExist(const string &FileName)
check if a file or its compressed variant exits
string CleanFileName(const string &fileIN)
cleans file names from obvious things
uint string2tokens(const string &str, vector< string > &tokens, const string &delimiters=" ", bool consecutive=false) __xprototype
size_t file2string(const string &FileNameIN, string &StringIN)
read the content of a file into a string
void InFileExistCheck(const string &routine, const string &FileNameRaw, const ifstream &file_to_check)
checks if a filestream is empty
uint string2dequestring(const string &stringIN, deque< string > &vstringout)
utype mode(const xvector< utype > &a)
bool string2compressfile(const string &content, const string &file_raw, const compression_type ct)
string to compressed file
utype max(const vector< utype > vec)
bool DirectoryMake(const string &directory_raw)
create a directory
void CompressionErrorHandling(archive *a, const int r, const std::string &message)
check compression calls
string utype2string(const utype &from, int precision=AUROSTD_DEFAULT_PRECISION, char FORMAT=DEFAULT_STREAM) __xprototype
size_t string2vectorstring(const string &stringIN, vector< string > &vstringout, bool consecutive=false, bool trim_edges=false)
size_t compressfile2vectorstring(const string &FileNameIN, vector< string > &vline, bool consecutive, bool trim_edges)
write the content of a compressed file into a vector of strings
bool FileExist(const string &FileName)
check if file exists
void compressfile2stringstream(const string &file_raw, stringstream &content)
write the content of a compressed file into a stringstream
bool FileEmpty(const string &FileNameRaw)
check if file is empty
string TmpDirectoryCreate(const string &identifier, const string &tmpdir, const bool hidden)
create a string pointing to the location of a unique temp directory
bool FileNotEmpty(const string &FileName)
check if file is not empty
string dirname(const string &file)
returns the dirname of file
size_t compressfile2string(const string &FileNameIN, string &content)
compressed file to string
bool SSH_DirectoryMake(const string &user, const string &machine, const string &directory_raw)
create a directory on a remote computer
bool CopyFile(const string &file_from, const string &file_to)
copy a file
string GetFileExtension(const string &FileName)
returns the file extension
bool CompressFileWithinList(const vector< string > &list, const string &input)
Determines whether a compressed file is within the list.
bool MatchCompressed(const string &CompressedFileName, const string &FileNameOUT)
compress a file based on the compression of another filed
bool IsCompressed(const string &FileNameIn)
check if a file is compressed
void DecompressFiles(const string &archive_file, const string &directory, const bool keep)
decompress files
bool IsDirectory(const string &path)
check if path is a directory
bool SubDirectoryLS(const string &directory_raw, vector< string > &vsubd)
returns all the subdirectories of a directory, including itself
bool LinkFile(const string &file_from, const string &file_to, const bool soft)
link a file
bool DirectoryWritable(const string &directory_raw)
create a temporary file to check if a directory is writable
bool file2file(const string &file, const string &destination)
move file to another file
string getPWD()
returns the current directory
void DecompressFile(const string &file_raw, const string &outfile_raw, const bool keep)
decompress file
bool stringstream2file(const stringstream &StringstreamOUTPUT, const string &FileNameOUTPUT, const compression_type ct, const string &mode)
write stringstream into a file
fs::path CompressFiles(const vector< string > &files_raw, const fs::path &relative_to_path, const string &archive_name, const compression_type ct, const bool keep)
compress files
bool DirectorySkipped(const string &directory)
check the existence of a SKIP file
bool DirectoryLocked(const string &directory, const string &LOCK)
check the existence of a LOCK file
void StringstreamClean(ostringstream &stream)
bool RemoveFile(const string &file)
remove a file
size_t file2vectorstring(const string &FileNameIN, vector< string > &vline, bool consecutive, bool trim_edges)
write the content of a file into a vector of strings
compression_type GetCompressionType(const fs::path &path)
bool compressfile2tempfile(const string &FileNameIN, string &FileNameOUT)
decompress a file to a temp file
void file2stringstream(const string &FileNameIN, stringstream &StringstreamIN)
write the content of a file into a stringstream 20241216 | Hagen Eckert - add transparent compression...
bool execute(ostringstream &command)
void CompressInit(archive *a, const compression_type ct, const bool single)
initialize compression