Added a method to test for junk-files, so they're ignored during patching
This commit is contained in:
parent
41a2e88d66
commit
5f333f7c77
3 changed files with 31 additions and 4 deletions
|
@ -8,7 +8,10 @@ Changelog
|
|||
- Changed FTLDat to allow opening dats in read-only mode
|
||||
- Changed modman.exe to fail rather than use VirtualStore
|
||||
- Added modman_admin.exe, which always runs as administrator
|
||||
- Added a Validate warning for junk files whose names end with a tilde
|
||||
- Added a Validate warning for junk files whose names start/end with tilde
|
||||
- Added a Validate warning for junk files whose names start+end with hash
|
||||
- Added a Validate warning for junk files named '.dropbox'
|
||||
- Added a check during patching to skip junk files
|
||||
- Added an error popup when the jar is double-clicked
|
||||
- Minor optimizations to reduce memory usage
|
||||
|
||||
|
|
|
@ -222,6 +222,12 @@ public class ModPatchThread extends Thread {
|
|||
continue;
|
||||
}
|
||||
|
||||
if ( ModUtilities.isJunkFile( innerPath ) ) {
|
||||
log.warn( String.format( "Skipping junk file: %s", innerPath ) );
|
||||
zis.closeEntry();
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( fileName.endsWith( ".xml.append" ) || fileName.endsWith( ".append.xml" ) ) {
|
||||
innerPath = parentPath + fileName.replaceAll( "[.](?:xml[.]append|append[.]xml)$", ".xml" );
|
||||
innerPath = checkCase( innerPath, knownPaths, knownPathsLower );
|
||||
|
|
|
@ -48,6 +48,8 @@ public class ModUtilities {
|
|||
|
||||
private static final Logger log = LogManager.getLogger(ModUtilities.class);
|
||||
|
||||
private static Pattern junkFilePtn = Pattern.compile( "[.]DS_Store$|(?:^|/)thumbs[.]db$|(?:^|/)[.]dropbox$|(?:^|/)~|~$|(?:^|/)#.+#$" );
|
||||
|
||||
|
||||
/**
|
||||
* Encodes a string (throwing an exception on bad chars) to bytes in a stream.
|
||||
|
@ -325,6 +327,24 @@ public class ModUtilities {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if a path matches known junk files, false otherwise.
|
||||
*
|
||||
* This includes:
|
||||
* *.DS_Store
|
||||
* thumbs.db
|
||||
* .dropbox
|
||||
* #*#
|
||||
* ~*
|
||||
* *~
|
||||
*
|
||||
* @param innerPath a path with forward slashes
|
||||
*/
|
||||
public static boolean isJunkFile( String innerPath ) {
|
||||
return junkFilePtn.matcher(innerPath).find();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks a mod file for common problems.
|
||||
*
|
||||
|
@ -337,8 +357,6 @@ public class ModUtilities {
|
|||
boolean modValid = true;
|
||||
boolean seenAppend = false;
|
||||
|
||||
Pattern junkFilePtn = Pattern.compile( "[.]DS_Store$|^thumbs[.]db$|~$" );
|
||||
|
||||
Pattern validRootDirPtn = Pattern.compile( "^(?:audio|data|fonts|img|mod-appendix)/" );
|
||||
List<String> seenJunkDirs = new ArrayList<String>();
|
||||
|
||||
|
@ -389,7 +407,7 @@ public class ModUtilities {
|
|||
}
|
||||
else if ( item.isDirectory() ) {
|
||||
}
|
||||
else if ( junkFilePtn.matcher(innerPath).find() ) {
|
||||
else if ( isJunkFile( innerPath ) ) {
|
||||
pendingMsgs.add( new ReportMessage(
|
||||
ReportMessage.ERROR,
|
||||
String.format( "Junk file" )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue