mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-04 06:37:41 +00:00
chore(android/engine): Tweak regex again
This commit is contained in:
parent
dedc76f975
commit
ab8562dc9d
2 changed files with 4 additions and 1 deletions
|
|
@ -72,7 +72,8 @@ public class PackageProcessor {
|
|||
public String getPackageID(File path) {
|
||||
// Sometimes, downloading a kmp multiple times results in a filename with a suffix:
|
||||
// " (#).kmp" or "-#.kmp" in the filename, so strip out the number
|
||||
String filename = path.getName().toLowerCase().replaceAll("(\\s+\\(|-)\\d+\\)?.kmp$", ".kmp");
|
||||
String filename = path.getName().toLowerCase().replaceAll(
|
||||
"\\s*((\\(\\d+\\))|(-\\d+))\\.kmp$", ".kmp");
|
||||
|
||||
if(resourceRoot == null) {
|
||||
throw new IllegalStateException("The PackageProcessor has not been initialized!");
|
||||
|
|
|
|||
|
|
@ -245,10 +245,12 @@ public class PackageProcessorTest {
|
|||
Assert.assertEquals(TEST_EN_CUSTOM_MODEL_NAME, PP.getPackageID(TEST_EN_CUSTOM_MODEL_KMP_FILE));
|
||||
|
||||
// Test trimming " (#)" from kmp name
|
||||
Assert.assertEquals("khmer_angkor", PP.getPackageID(new File("khmer_angkor(10).kmp")));
|
||||
Assert.assertEquals("khmer_angkor", PP.getPackageID(new File("khmer_angkor (10).kmp")));
|
||||
|
||||
// Test trimming "-#" from kmp name
|
||||
Assert.assertEquals("khmer_angkor", PP.getPackageID(new File("khmer_angkor-10.kmp")));
|
||||
Assert.assertEquals("khmer_angkor", PP.getPackageID(new File("khmer_angkor -10.kmp")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue