fix(StorageServiceImpl, StaticResourceServiceImpl): update path handling for jar resources and improve method signatures
This commit is contained in:
@@ -33,9 +33,9 @@ public class StaticResourceServiceImpl implements StaticResourceService {
|
|||||||
parent = Paths.get(url.toString().substring("jar:nested:".length(), url.toString().indexOf("/!"))).getParent();
|
parent = Paths.get(url.toString().substring("jar:nested:".length(), url.toString().indexOf("/!"))).getParent();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
parent = Paths.get(url.toURI()).getParent();
|
parent = url.toURI().toPath().getParent();
|
||||||
}
|
}
|
||||||
final Path jarPath = parent != null ? parent.toAbsolutePath().normalize() : Paths.get(url.toURI()).toAbsolutePath().normalize();
|
final Path jarPath = parent != null ? parent.toAbsolutePath().normalize() : url.toURI().toPath().toAbsolutePath().normalize();
|
||||||
|
|
||||||
final String currentSubDir = jarPath.getFileName().toString();
|
final String currentSubDir = jarPath.getFileName().toString();
|
||||||
if ("bin".equals(currentSubDir) || "target".equals(currentSubDir)) {
|
if ("bin".equals(currentSubDir) || "target".equals(currentSubDir)) {
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ import java.util.Objects;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import de.extio.game_engine.util.ObjectSerialization;
|
|
||||||
import de.extio.game_engine.util.rng.FastRandomUUID;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import de.extio.game_engine.util.ObjectSerialization;
|
||||||
|
import de.extio.game_engine.util.rng.FastRandomUUID;
|
||||||
|
|
||||||
public class StorageServiceImpl implements StorageService {
|
public class StorageServiceImpl implements StorageService {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(StorageServiceImpl.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(StorageServiceImpl.class);
|
||||||
@@ -43,9 +43,9 @@ public class StorageServiceImpl implements StorageService {
|
|||||||
parent = Paths.get(url.toString().substring("jar:nested:".length(), url.toString().indexOf("/!"))).getParent();
|
parent = Paths.get(url.toString().substring("jar:nested:".length(), url.toString().indexOf("/!"))).getParent();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
parent = Paths.get(url.toURI()).getParent();
|
parent = url.toURI().toPath().getParent();
|
||||||
}
|
}
|
||||||
final Path jarPath = parent != null ? parent.toAbsolutePath().normalize() : Paths.get(url.toURI()).toAbsolutePath().normalize();
|
final Path jarPath = parent != null ? parent.toAbsolutePath().normalize() : url.toURI().toPath().toAbsolutePath().normalize();
|
||||||
|
|
||||||
final String currentSubDir = jarPath.getFileName().toString();
|
final String currentSubDir = jarPath.getFileName().toString();
|
||||||
if ("bin".equals(currentSubDir) || "target".equals(currentSubDir)) {
|
if ("bin".equals(currentSubDir) || "target".equals(currentSubDir)) {
|
||||||
@@ -348,17 +348,17 @@ public class StorageServiceImpl implements StorageService {
|
|||||||
private boolean closed = false;
|
private boolean closed = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(int b) throws IOException {
|
public void write(final int b) throws IOException {
|
||||||
outputStream.write(b);
|
outputStream.write(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(byte[] b) throws IOException {
|
public void write(final byte[] b) throws IOException {
|
||||||
outputStream.write(b);
|
outputStream.write(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(byte[] b, int off, int len) throws IOException {
|
public void write(final byte[] b, final int off, final int len) throws IOException {
|
||||||
outputStream.write(b, off, len);
|
outputStream.write(b, off, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user