fix: dependency scan ignores folders above the game folder (#859)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-15 07:03:17 -04:00
1 parent d3b0b8e51c
commit 9e7b4c0b50
2 files changed
+19 -1

No files matched your search

@@ -76,7 +76,7 @@ object DependencyDetector {
fun consider(f: File, isDir: Boolean, insideRedist: Boolean) {
val name = f.name.lowercase(Locale.US)
val path = f.path.replace('\\', '/').lowercase(Locale.US)
val path = relativeReason(gameDir, f).lowercase(Locale.US)
val kind = if (insideRedist || isDir || name.endsWith(".exe") || name.endsWith(".msi") || name.endsWith(".cab"))
Kind.BUNDLED else Kind.SHIPPED
for (comp in classify(path, name, isDir)) {
@@ -0,0 +1,18 @@
package com.droiddeck.launcher.frontend
import java.io.File
import org.junit.Assert.assertEquals
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
class DependencyDetectorTest {
@get:Rule val tmp = TemporaryFolder()
@Test fun foldersAboveTheGameDoNotChangeWhatIsFound() {
val folder = File(tmp.newFolder("Games 2005", "agility"), "Game")
File(folder, "_CommonRedist/vcredist/2013").mkdirs()
File(folder, "_CommonRedist/vcredist/2013/vcredist_x64.exe").writeText("x")
assertEquals(listOf("vcredist2013"), DependencyDetector.detect(folder).map { it.componentName })
}
}