在 Qt(C++) 中使用 QProcess 解压缩 - 提取目录问题
Unzip with WinRar in Qt(C++) using QProcess - extract directory problem
我有这段代码来解压缩文件夹。它可以工作,但我不知道如何更改提取目录。每次,它都会将文件夹提取到我的程序.exe文件的目录中。我尝试了一些东西,但每次,它只是在那里提取。我想选择目录。
QString program = "c:/program files/winRAR/winRAR.exe";
QStringList arguments;
arguments << "x"; // extract files and directories
arguments << "-y"; // suppress questions
arguments << "-o" + QDir::toNativeSeparators(extractDirectory);
arguments << QDir::toNativeSeparators(zipFileDirectory);
QProcess *myProcess = new QProcess(parent);
myProcess->start(program, arguments);
我会说,在 -o 参数后面编写 extractDirectory 存在问题,但不确定。 感谢您的任何帮助。
感谢一些评论,我发现 -o 参数在 WinRAR 中不存在,这是解决方案。
QString program = "c:/program files/winRAR/winRAR.exe";
QStringList arguments;
arguments << "x"; // extract files and directories
arguments << "-y"; // suppress questions
arguments << QDir::toNativeSeparators(zipFileDirectory);
arguments << QDir::toNativeSeparators(extractDirectory);
QProcess *myProcess = new QProcess(parent);
myProcess->start(program, arguments);
谢谢大家。
相关文章:
- 使用C++进行运行长度解压缩
- C++ 如何将数组值解压缩为函数参数
- struct.error:解压缩 C++ 结构时,解包需要 288 字节的缓冲区
- 在 Qt(C++) 中使用 QProcess 解压缩 - 提取目录问题
- 浏览压缩文件与游览解压缩它们
- 如何在C++向量中解压缩多个值
- 解压缩 C 样式数组以及C++中的参数包
- 如何在 cpp 中解压缩数字,如果它们是使用 struct.pack(fmt, v1, v2, ..) 打包在 pyth
- 如何使用 Poco::ZIP 压缩/解压缩 zip 文件
- 在编译时解压缩数组扩展数据块 (C++11/14)
- 使用 RtMidi 解压缩 Midi 时间码
- 将参数包解压缩到 std::initializer_list?
- 解压缩可变模板参数
- 解压缩附加的压缩字符串
- 使用 AVX2 将 8 位从 32 位值 (__m256i) 解压缩到__m256的最快方法
- C++宏解压缩并加入
- 解压缩串联的 zlib 流而不读取下一个字节
- 解压缩位大小不能被 8 整除的值流
- 为流运算符返回代理类时解压缩参数
- c++解压缩返回无法创建提取目录