Skip to content

Commit

Permalink
use English locale in toLowerCase() instead of default
Browse files Browse the repository at this point in the history
The default depends on the target machine and may not produce consistent
results.
  • Loading branch information
memo33 committed Jul 29, 2024
1 parent 370cfd6 commit b10c43f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ assembly / assemblyJarName := s"${name.value}-cli.jar"
//
assembly / assemblyMergeStrategy := {
case p0 @ PathList("META-INF", xs @ _*) =>
(xs.map(_.toLowerCase)) match {
(xs.map(_.toLowerCase(java.util.Locale.ENGLISH))) match {
case p1 if p1.last == "module-info.class" => MergeStrategy.discard
case p1 if p1.last == "javax.inject.named" => MergeStrategy.filterDistinctLines
case p1 if p1.last == "io.netty.versions.properties" => MergeStrategy.filterDistinctLines
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/sc4pac/Constants.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@ object Constants {
true
}

def isDll(path: os.Path): Boolean = path.last.toLowerCase.endsWith(".dll")
def isDll(path: os.Path): Boolean = path.last.toLowerCase(java.util.Locale.ENGLISH).endsWith(".dll")
}
2 changes: 1 addition & 1 deletion src/main/scala/sc4pac/Prompt.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ object Prompt {
} yield {
if (input.isEmpty) default
else {
val matches: Seq[String] = options.filter(_.toLowerCase().startsWith(input.toLowerCase()))
val matches: Seq[String] = options.filter(_.toLowerCase(java.util.Locale.ENGLISH).startsWith(input.toLowerCase(java.util.Locale.ENGLISH)))
matches match {
case Seq(unique) => Some(unique)
case _ => None
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/sc4pac/extractor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import sc4pac.error.ExtractionFailed
object Extractor {

def acceptNestedArchive(p: os.BasePath) = {
val name = p.last.toLowerCase
val name = p.last.toLowerCase(java.util.Locale.ENGLISH)
name.endsWith(".jar") || name.endsWith(".zip") || name.endsWith(".7z") || name.endsWith(".exe")
}

Expand Down Expand Up @@ -47,7 +47,7 @@ object Extractor {

private object WrappedArchive {
def apply(file: java.io.File, fallbackFilename: Option[String], stagingRoot: os.Path, logger: Logger, hints: Option[JD.ArchiveType]): WrappedArchive[?] = {
val lcNames: Seq[String] = Seq(file.getName.toLowerCase) ++ fallbackFilename.map(_.toLowerCase)
val lcNames: Seq[String] = Seq(file.getName.toLowerCase(java.util.Locale.ENGLISH)) ++ fallbackFilename.map(_.toLowerCase(java.util.Locale.ENGLISH))
if (lcNames.exists(_.endsWith(".exe")) && hints.exists(_.format.equalsIgnoreCase(JD.ArchiveType.clickteamFormat))) {
/* Clickteam installer */
val tempExtractionDir = os.temp.dir(stagingRoot, prefix = "exe", deleteOnExit = false) // the parent stagingRoot is already temporary and will be deleted
Expand Down

0 comments on commit b10c43f

Please sign in to comment.