Skip to content

Commit

Permalink
respect previous canWrite state
Browse files Browse the repository at this point in the history
  • Loading branch information
Frotty committed Oct 8, 2018
1 parent f000fec commit 40ee3bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group 'systems.crigges'
version '1.7.3'
version '1.7.5'

repositories {
jcenter()
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/systems/crigges/jmpq3/JMpqEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,11 @@ private void readListFile() {
tempFile.deleteOnExit();
extractFile("(listfile)", tempFile);
listFile = new Listfile(Files.readAllBytes(tempFile.toPath()));
canWrite = listFile.getFiles().size() >= blockTable.getAllVaildBlocks().size() - 2;
if(! canWrite) {
log.warn("mpq's listfile is incomplete, switching to readonly.");
if(canWrite) {
canWrite = listFile.getFiles().size() >= blockTable.getAllVaildBlocks().size() - 2;
if (!canWrite) {
log.warn("mpq's listfile is incomplete, switching to readonly.");
}
}
} catch (Exception e) {
log.warn("Extracting the mpq's listfile failed. It cannot be rebuild.", e);
Expand Down

0 comments on commit 40ee3bb

Please sign in to comment.