Lens AI Profiler Cpp
tar_gz_creator.h
1 #ifndef TAR_GZ_CREATOR_H
2 #define TAR_GZ_CREATOR_H
3 
4 #include <libtar.h>
5 #include <vector>
6 #include <string>
7 #include <mutex>
8 
9 class TarGzCreator {
10 public:
11  TarGzCreator();
12  bool createTar(const std::string& tarFilePath, const std::vector<std::string>& filePaths,const std::string& basePath);
13  bool compressToGz(const std::string& tarFilePath, const std::string& gzFilePath);
14  std::vector<std::string> collectFilesFromFolders(const std::vector<std::string>& folders);
15  bool decompressGz(const std::string& gzFilePath, const std::string& outputFilePath);
16  bool unpackTar(const std::string& tarFilePath, const std::string& outputFolderPath);
17  bool emptyFolder(const std::string& folderPath); // New function to empty folder
18 
19 private:
20  void add_file_to_tar(TAR *tar, const std::string& path,
21  const std::string& basePath);
22  std::mutex folderMutex; // Mutex for thread-safe folder access
23 };
24 
25 #endif // TAR_GZ_CREATOR_H
Definition: tar_gz_creator.h:9