#include <CompressorImplSystem.hpp>
系统命令后端
通过调用系统安装的命令行工具进行压缩:
- tar → .tar, .tar.gz, .tar.bz2, .tar.xz
- zip → .zip
- 7z → .7z
◆ canCompress()
检查该压缩实现是否能处理指定源文件/目录并生成目标格式
默认返回 true;子类可重写以检查目标扩展名或源文件类型
- 参数
-
| source | 待压缩的源文件或目录路径 |
| target | 压缩目标路径(用于判断目标格式) |
- 返回
- true 如果能处理,false 否则
重载 ast::CompressorInterface .
◆ compress()
压缩文件或目录
- 参数
-
| source | 要压缩的文件或目录的路径 |
| target | 压缩目标路径 |
| curdir | 工作目录,source 在归档中的路径相对于此目录计算 (空串=从 source 父目录推断;等于 source=归档根为".") |
- 返回
- errc_t 错误码
实现了 ast::CompressorInterface.
◆ isSupported()
| bool ast::CompressorImplSystem::isSupported |
( |
| ) |
const |
|
overridevirtual |
检查该压缩实现是否在当前环境中可用
例如:基于 Shell COM 的实现检查是否是 Windows, 基于系统命令的实现检查是否安装了对应的命令行工具
- 返回
- true 如果可用,false 否则
重载 ast::CompressorInterface .
该类的文档由以下文件生成:
- src/AstUtil/Archiver/CompressorImpl/CompressorImplSystem.hpp
- src/AstUtil/Archiver/CompressorImpl/CompressorImplSystem.cpp