diff --git a/skel_common/readme_changelog.txt b/skel_common/readme_changelog.txt index 42fcc0e..3499b2e 100644 --- a/skel_common/readme_changelog.txt +++ b/skel_common/readme_changelog.txt @@ -1,5 +1,10 @@ Changelog +1.8: +- Fixed endless prompting about Steam on startup for standalone distros +- Fixed mods not being added to FTL's resources +- Fixed 'stream closed' error during patching + 1.7: - Added support for FTL 1.6.1 - Added a config option to launch FTL via Steam, if possible diff --git a/src/main/java/net/vhati/ftldat/AbstractPack.java b/src/main/java/net/vhati/ftldat/AbstractPack.java index 815cc0f..5a22f5d 100644 --- a/src/main/java/net/vhati/ftldat/AbstractPack.java +++ b/src/main/java/net/vhati/ftldat/AbstractPack.java @@ -31,7 +31,7 @@ public abstract class AbstractPack { } /** - * Adds bytes read from srcFile to the pack, as innerPath. + * Adds bytes read from an InputStream to the pack, as innerPath. */ public void add( String innerPath, InputStream is ) throws IOException { throw new UnsupportedOperationException(); diff --git a/src/main/java/net/vhati/ftldat/PackContainer.java b/src/main/java/net/vhati/ftldat/PackContainer.java index 507cc68..236410e 100644 --- a/src/main/java/net/vhati/ftldat/PackContainer.java +++ b/src/main/java/net/vhati/ftldat/PackContainer.java @@ -88,7 +88,7 @@ public class PackContainer { public AbstractPack getPackFor( String innerPath ) { Matcher m = pathPtn.matcher( innerPath ); if ( m.matches() ) { - String root = m.group( 1 ); + String root = m.group( 2 ); AbstractPack rootPack = rootMap.get( root ); if ( rootPack != null ) return rootPack; diff --git a/src/main/java/net/vhati/ftldat/PkgPack.java b/src/main/java/net/vhati/ftldat/PkgPack.java index b6901fa..51f045f 100644 --- a/src/main/java/net/vhati/ftldat/PkgPack.java +++ b/src/main/java/net/vhati/ftldat/PkgPack.java @@ -566,6 +566,9 @@ public class PkgPack extends AbstractPack { return result; } + /** + * Adds bytes read from an InputStream to the pack, as innerPath. + */ @Override public void add( String innerPath, InputStream is ) throws IOException { if ( innerPath.indexOf( "\\" ) != -1 ) { @@ -608,19 +611,18 @@ public class PkgPack extends AbstractPack { } // Write data. - try { - raf.seek( entry.dataOffset ); - byte[] buf = new byte[4096]; - int len; - while ( (len = dataStream.read( buf )) >= 0 ) { - raf.write( buf, 0, len ); - } - } - finally { - try {if ( dataStream != null ) dataStream.close();} - catch ( IOException e ) {} + raf.seek( entry.dataOffset ); + byte[] buf = new byte[4096]; + int len; + while ( (len = dataStream.read( buf )) >= 0 ) { + raf.write( buf, 0, len ); } + // Attempting to close the wrapper streams would cause an exception if + // the original stream was a ZipInputStream, which would need closeEntry(). + + // TODO: Test if compression works without closing the wrapper. + // Go back and fill in the dataSize. entry.dataSize = raf.getChannel().position() - entry.dataOffset; entry.unpackedSize = srcMeterStream.getCount(); diff --git a/src/main/java/net/vhati/modmanager/core/ModPatchThread.java b/src/main/java/net/vhati/modmanager/core/ModPatchThread.java index 5cd2ce4..160569f 100644 --- a/src/main/java/net/vhati/modmanager/core/ModPatchThread.java +++ b/src/main/java/net/vhati/modmanager/core/ModPatchThread.java @@ -260,8 +260,11 @@ public class ModPatchThread extends Thread { AbstractPack pack = packContainer.getPackFor( innerPath ); if ( pack == null ) { - if ( !knownRoots.contains( root ) ) + if ( !knownRoots.contains( root ) ) { log.warn( String.format( "Unexpected innerPath: %s", innerPath ) ); + } else { + log.debug( String.format( "Ignoring innerPath with known root: %s", innerPath ) ); + } zis.closeEntry(); continue; } diff --git a/src/main/java/net/vhati/modmanager/core/SlipstreamConfig.java b/src/main/java/net/vhati/modmanager/core/SlipstreamConfig.java index 4230cf6..fc051a6 100644 --- a/src/main/java/net/vhati/modmanager/core/SlipstreamConfig.java +++ b/src/main/java/net/vhati/modmanager/core/SlipstreamConfig.java @@ -16,6 +16,7 @@ public class SlipstreamConfig { public static final String ALLOW_ZIP = "allow_zip"; public static final String FTL_DATS_PATH = "ftl_dats_path"; + public static final String STEAM_DISTRO = "steam_distro"; public static final String STEAM_EXE_PATH = "steam_exe_path"; public static final String RUN_STEAM_FTL = "run_steam_ftl"; public static final String NEVER_RUN_FTL = "never_run_ftl"; @@ -81,8 +82,9 @@ public class SlipstreamConfig { userFieldsMap.put( ALLOW_ZIP, "Sets whether to treat .zip files as .ftl files. Default: false." ); userFieldsMap.put( FTL_DATS_PATH, "The path to FTL's resources folder. If invalid, you'll be prompted." ); + userFieldsMap.put( STEAM_DISTRO, "If true, FTL was installed via Steam. Stops the GUI asking for a path." ); userFieldsMap.put( STEAM_EXE_PATH, "The path to Steam's executable, if FTL was installed via Steam." ); - userFieldsMap.put( RUN_STEAM_FTL, "If true, SMM will use Steam to launch FTL, if possible. Default: false." ); + userFieldsMap.put( RUN_STEAM_FTL, "If true, SMM will use Steam to launch FTL, if possible." ); userFieldsMap.put( NEVER_RUN_FTL, "If true, there will be no offer to run FTL after patching. Default: false." ); userFieldsMap.put( UPDATE_CATALOG, "If a number greater than 0, check for new mod descriptions every N days." ); userFieldsMap.put( UPDATE_APP, "If a number greater than 0, check for newer app versions every N days." ); diff --git a/src/main/java/net/vhati/modmanager/json/JacksonAutoUpdateReader.java b/src/main/java/net/vhati/modmanager/json/JacksonAutoUpdateReader.java index 4000383..405ec83 100644 --- a/src/main/java/net/vhati/modmanager/json/JacksonAutoUpdateReader.java +++ b/src/main/java/net/vhati/modmanager/json/JacksonAutoUpdateReader.java @@ -54,7 +54,7 @@ public class JacksonAutoUpdateReader { JsonNode changelogNode = historyNode.get( "changelog" ); for ( JsonNode releaseNode : changelogNode ) { - // Skip any versions with optional "hidden" field set to true. + // Skip any versions with optional "hidden" field set to true (true without quotes!). if ( releaseNode.get( "hidden" ) != null && releaseNode.get( "hidden" ).booleanValue() ) { continue; }