Skip to content

Commit 639e02c

Browse files
committed
Preserve Warcraft III path opt-out
1 parent 6631196 commit 639e02c

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/main/kotlin/file/SetupApp.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,10 @@ object SetupApp {
367367
}
368368

369369
private fun resolveGenerateGamePath(setup: SetupMain, wc3Patch: String?): Path? {
370+
if (setup.gamePathOptedOut) {
371+
log.info("Warcraft III path: not configured by choice.")
372+
return null
373+
}
370374
val gameRoot = setup.gamePath ?: Wc3ClientDetector.detectGameRoot()
371375
val clientInfo = Wc3ClientDetector.inspectGameRoot(gameRoot)
372376
if (clientInfo == null) {
@@ -595,7 +599,8 @@ object SetupApp {
595599
useInteractiveMenus = useInteractiveMenus,
596600
currentPatch = setup.wc3Patch
597601
)
598-
setup.gamePath = selectGamePath(prompt, setup.wc3Patch, setup.gamePath)
602+
setup.gamePathOptedOut = false
603+
setup.gamePath = selectGamePath(setup, prompt, setup.wc3Patch, setup.gamePath)
599604

600605
val agentsDefault = if (setup.addAgents) "Y" else "N"
601606
val agentsInput = prompt("Add AGENTS.md?", agentsDefault) ?: agentsDefault
@@ -632,6 +637,7 @@ object SetupApp {
632637
}
633638

634639
private fun selectGamePath(
640+
setup: SetupMain,
635641
prompt: (String, String?) -> String?,
636642
wc3Patch: String?,
637643
currentPath: Path?
@@ -648,6 +654,7 @@ object SetupApp {
648654
val default = detected?.toAbsolutePath()?.normalize()?.toString() ?: "none"
649655
val answer = prompt("Warcraft III directory (or none)", default)?.trim() ?: return detected
650656
if (answer.equals("none", ignoreCase = true) || answer.equals("skip", ignoreCase = true)) {
657+
setup.gamePathOptedOut = true
651658
return null
652659
}
653660
val selected = Paths.get(answer).toAbsolutePath().normalize()

src/main/kotlin/file/SetupMain.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class SetupMain {
2121

2222
var gamePath: Path? = null
2323

24+
var gamePathOptedOut: Boolean = false
25+
2426
var requireConfirmation = false
2527

2628
var noPJass = false

src/test/kotlin/GenerateTests.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ class GenerateTests {
412412
Assert.assertEquals(setup.commandArg, "wizardproject")
413413
Assert.assertEquals(setup.scriptMode, ScriptMode.JASS)
414414
Assert.assertEquals(setup.wc3Patch, CoreJassProvider.PRE_129_PATCH)
415+
Assert.assertTrue(setup.gamePathOptedOut)
415416
Assert.assertTrue(setup.addAgents)
416417
Assert.assertTrue(setup.addGithubWorkflow)
417418
Assert.assertTrue(setup.curatedDependencyIds.isEmpty())

0 commit comments

Comments
 (0)