summaryrefslogtreecommitdiffstats
path: root/src/archive_manager.hh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 04:48:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 04:48:35 +0000
commit207df6fc406e81bfeebdff7f404bd242ff3f099f (patch)
treea1a796b056909dd0a04ffec163db9363a8757808 /src/archive_manager.hh
parentReleasing progress-linux version 0.11.2-1~progress7.99u1. (diff)
downloadlnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.tar.xz
lnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.zip
Merging upstream version 0.12.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/archive_manager.hh')
-rw-r--r--src/archive_manager.hh20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/archive_manager.hh b/src/archive_manager.hh
index 777ae87..7fab86f 100644
--- a/src/archive_manager.hh
+++ b/src/archive_manager.hh
@@ -37,8 +37,11 @@
#include <string>
#include <utility>
+#include "base/file_range.hh"
#include "base/result.h"
#include "ghc/filesystem.hpp"
+#include "mapbox/variant.hpp"
+#include "optional.hpp"
namespace archive_manager {
@@ -56,7 +59,22 @@ struct extract_progress {
using extract_cb
= std::function<extract_progress*(const ghc::filesystem::path&, ssize_t)>;
-bool is_archive(const ghc::filesystem::path& filename);
+struct archive_info {
+ struct entry {
+ ghc::filesystem::path e_name;
+ const char* e_mode;
+ time_t e_mtime;
+ nonstd::optional<file_ssize_t> e_size;
+ };
+ const char* ai_format_name;
+ std::vector<entry> ai_entries;
+};
+struct unknown_file {};
+
+using describe_result = mapbox::util::variant<archive_info, unknown_file>;
+
+Result<describe_result, std::string> describe(
+ const ghc::filesystem::path& filename);
ghc::filesystem::path filename_to_tmp_path(const std::string& filename);