forked from Qortal/qortal
Updated various places that used File.separator when they could have used Paths.get()
This commit is contained in:
parent
67db0f950b
commit
87b724ec72
@ -40,7 +40,7 @@ public class HTMLParser {
|
||||
for (Element element : href) {
|
||||
String elementHtml = element.attr("href");
|
||||
if (this.shouldReplaceLink(elementHtml)) {
|
||||
String slash = (elementHtml.startsWith("/") ? "" : File.separator);
|
||||
String slash = (elementHtml.startsWith("/") ? "" : "/");
|
||||
element.attr("href", this.linkPrefix + slash + element.attr("href"));
|
||||
}
|
||||
}
|
||||
@ -48,7 +48,7 @@ public class HTMLParser {
|
||||
for (Element element : src) {
|
||||
String elementHtml = element.attr("src");
|
||||
if (this.shouldReplaceLink(elementHtml)) {
|
||||
String slash = (elementHtml.startsWith("/") ? "" : File.separator);
|
||||
String slash = (elementHtml.startsWith("/") ? "" : "/");
|
||||
element.attr("src", this.linkPrefix + slash + element.attr("src"));
|
||||
}
|
||||
}
|
||||
@ -60,7 +60,7 @@ public class HTMLParser {
|
||||
ArrayList<String> newParts = new ArrayList<>();
|
||||
for (String part : parts) {
|
||||
part = part.trim();
|
||||
String slash = (elementHtml.startsWith("/") ? "" : File.separator);
|
||||
String slash = (elementHtml.startsWith("/") ? "" : "/");
|
||||
String newPart = this.linkPrefix + slash + part;
|
||||
newParts.add(newPart);
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ public class ArbitraryDataReader {
|
||||
byte[] secret = this.secret58 != null ? Base58.decode(this.secret58) : null;
|
||||
if (secret != null && secret.length == Transformer.AES256_LENGTH) {
|
||||
try {
|
||||
Path unencryptedPath = Paths.get(this.workingPath.toString() + File.separator + "zipped.zip");
|
||||
Path unencryptedPath = Paths.get(this.workingPath.toString(), "zipped.zip");
|
||||
SecretKey aesKey = new SecretKeySpec(secret, 0, secret.length, "AES");
|
||||
AES.decryptFile("AES", aesKey, this.filePath.toString(), unencryptedPath.toString());
|
||||
|
||||
|
@ -19,6 +19,7 @@ import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -88,7 +89,7 @@ public class ArbitraryDataRenderer {
|
||||
|
||||
try {
|
||||
String filename = this.getFilename(unzippedPath, inPath);
|
||||
String filePath = unzippedPath + File.separator + filename;
|
||||
String filePath = Paths.get(unzippedPath, filename).toString();
|
||||
|
||||
if (HTMLParser.isHtmlFile(filename)) {
|
||||
// HTML file - needs to be parsed
|
||||
@ -136,8 +137,8 @@ public class ArbitraryDataRenderer {
|
||||
// Locate index file
|
||||
List<String> indexFiles = ArbitraryDataRenderer.indexFiles();
|
||||
for (String indexFile : indexFiles) {
|
||||
String filePath = directory + File.separator + indexFile;
|
||||
if (Files.exists(Paths.get(filePath))) {
|
||||
Path path = Paths.get(directory, indexFile);
|
||||
if (Files.exists(path)) {
|
||||
return userPath + indexFile;
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ public class ArbitraryDataWriter {
|
||||
private void compress() throws InterruptedException, DataException {
|
||||
// Compress the data if requested
|
||||
if (this.compression != Compression.NONE) {
|
||||
this.compressedPath = Paths.get(this.workingPath.toString() + File.separator + "data.zip");
|
||||
this.compressedPath = Paths.get(this.workingPath.toString(), "data.zip");
|
||||
try {
|
||||
|
||||
if (this.compression == Compression.ZIP) {
|
||||
@ -212,7 +212,7 @@ public class ArbitraryDataWriter {
|
||||
}
|
||||
|
||||
private void encrypt() throws DataException {
|
||||
this.encryptedPath = Paths.get(this.workingPath.toString() + File.separator + "data.zip.encrypted");
|
||||
this.encryptedPath = Paths.get(this.workingPath.toString(), "data.zip.encrypted");
|
||||
try {
|
||||
// Encrypt the file with AES
|
||||
LOGGER.info("Encrypting...");
|
||||
|
@ -40,8 +40,7 @@ public class ResourceList {
|
||||
/* Filesystem */
|
||||
|
||||
private Path getFilePath() {
|
||||
String pathString = String.format("%s%s%s.json", Settings.getInstance().getListsPath(),
|
||||
File.separator, this.name);
|
||||
String pathString = String.format("%s.json", Paths.get(Settings.getInstance().getListsPath(), this.name));
|
||||
return Paths.get(pathString);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user