mirror of
https://github.com/Retera/WarsmashModEngine.git
synced 2022-07-31 17:38:59 +02:00
GNU+Linux support with folder data source patch
This commit is contained in:
parent
a5d4085e47
commit
7ab1fa3193
@ -33,7 +33,8 @@ public class FolderDataSource implements DataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream getResourceAsStream(final String filepath) throws IOException {
|
public InputStream getResourceAsStream(String filepath) throws IOException {
|
||||||
|
filepath=fixFilepath(filepath);
|
||||||
if (!has(filepath)) {
|
if (!has(filepath)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -41,7 +42,8 @@ public class FolderDataSource implements DataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getFile(final String filepath) throws IOException {
|
public File getFile(String filepath) throws IOException {
|
||||||
|
filepath=fixFilepath(filepath);
|
||||||
if (!has(filepath)) {
|
if (!has(filepath)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -49,7 +51,8 @@ public class FolderDataSource implements DataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean has(final String filepath) {
|
public boolean has(String filepath) {
|
||||||
|
filepath=fixFilepath(filepath);
|
||||||
if ("".equals(filepath)) {
|
if ("".equals(filepath)) {
|
||||||
return false; // special case for folder data source, dont do this
|
return false; // special case for folder data source, dont do this
|
||||||
}
|
}
|
||||||
@ -66,4 +69,7 @@ public class FolderDataSource implements DataSource {
|
|||||||
public void close() {
|
public void close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String fixFilepath(String filepath) {
|
||||||
|
return filepath.replace('\\', File.separatorChar).replace('/', File.separatorChar);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user