refactor(用例管理): 获取下载文件的权限
This commit is contained in:
parent
9b954e3abb
commit
3601f8a6c0
|
@ -52,7 +52,7 @@ public class XMindParser {
|
||||||
File dir = new File(res);
|
File dir = new File(res);
|
||||||
FileUtils.deleteDirectory(dir);
|
FileUtils.deleteDirectory(dir);
|
||||||
}
|
}
|
||||||
// 删除零时文件
|
// 删除临时文件
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package io.metersphere.functional.xmind.parser;
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import org.apache.commons.compress.archivers.ArchiveException;
|
import org.apache.commons.compress.archivers.ArchiveException;
|
||||||
import org.apache.commons.compress.archivers.examples.Expander;
|
import org.apache.commons.compress.archivers.examples.Expander;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -15,8 +16,6 @@ import java.util.Objects;
|
||||||
*/
|
*/
|
||||||
public class ZipUtils {
|
public class ZipUtils {
|
||||||
|
|
||||||
private static final String CURRENT_PATH = System.getProperty("user.dir");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 找到压缩文件中匹配的子文件,返回的为 getContents("comments.xml, unzip
|
* 找到压缩文件中匹配的子文件,返回的为 getContents("comments.xml, unzip
|
||||||
*
|
*
|
||||||
|
@ -44,7 +43,7 @@ public class ZipUtils {
|
||||||
*/
|
*/
|
||||||
public static String extract(File file) throws IOException, ArchiveException {
|
public static String extract(File file) throws IOException, ArchiveException {
|
||||||
Expander expander = new Expander();
|
Expander expander = new Expander();
|
||||||
String destFileName = CURRENT_PATH + File.separator + "XMind" + System.currentTimeMillis();
|
String destFileName = FileUtils.getTempDirectoryPath()+ File.separator + "XMind" + System.currentTimeMillis();
|
||||||
expander.expand(file, new File(destFileName));
|
expander.expand(file, new File(destFileName));
|
||||||
return destFileName;
|
return destFileName;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue