manually replace %20 w/ space

This commit is contained in:
Connor Tumbleson 2016-12-25 08:47:20 -05:00
parent 3ba82b08e3
commit 78a7724725
2 changed files with 12 additions and 17 deletions

View File

@ -98,7 +98,11 @@ public abstract class TestUtils {
URL dirURL = class_.getClassLoader().getResource(dirPath);
if (dirURL != null && dirURL.getProtocol().equals("file")) {
DirUtil.copyToDir(new FileDirectory(dirURL.getFile()), out);
try {
DirUtil.copyToDir(new FileDirectory(dirURL.getFile()), out);
} catch (UnsupportedEncodingException ex) {
throw new BrutException(ex);
}
return;
}
@ -111,10 +115,10 @@ public abstract class TestUtils {
String jarPath;
try {
jarPath = URLDecoder.decode(dirURL.getPath().substring(5, dirURL.getPath().indexOf("!")), "UTF-8");
DirUtil.copyToDir(new FileDirectory(jarPath), out);
} catch (UnsupportedEncodingException ex) {
throw new BrutException(ex);
}
DirUtil.copyToDir(new FileDirectory(jarPath), out);
}
}

View File

@ -16,29 +16,20 @@
package brut.directory;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Paths;
import java.io.*;
import java.net.URLDecoder;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
public class FileDirectory extends AbstractDirectory {
private File mDir;
public FileDirectory(String dir) throws DirectoryException {
this(Paths.get(dir).toFile());
public FileDirectory(ExtFile dir, String folder) throws DirectoryException, UnsupportedEncodingException {
this(new File(dir.toString().replaceAll("%20", " "), folder));
}
public FileDirectory(ExtFile dir, String folder) throws DirectoryException {
this(dir.toString(), folder);
}
public FileDirectory(String dir, String folder) throws DirectoryException {
this(Paths.get(dir, folder).toFile());
public FileDirectory(String dir) throws DirectoryException, UnsupportedEncodingException {
this(new File(URLDecoder.decode(dir, "UTF-8")));
}
public FileDirectory(File dir) throws DirectoryException {