Skip to content

Commit bbbe700

Browse files
committed
Added option to Keep Repo or not instead of always keeping repo
1 parent dc44654 commit bbbe700

File tree

1 file changed

+61
-50
lines changed

1 file changed

+61
-50
lines changed

sm_osx/RomView.swift

Lines changed: 61 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ struct RomView: View {
107107
@State var allowFinish = true
108108
@State var log = ""
109109
@State var doLauncher = true
110+
@State var doKeepRepo = true
110111
@State var betterCamera = 0
111112
@State var drawDistance = 0
112113
@State var highFPS = 0
@@ -194,21 +195,23 @@ struct RomView: View {
194195

195196
var execPath = "sm64ex-coop-build"
196197

197-
let checkExecPath = try? shell.shell("ls ~/SM64Repos/")
198-
199-
var numbCur = 0
200-
201-
while checkExecPath!.contains(execPath) {
198+
if doKeepRepo {
199+
let checkExecPath = try? shell.shell("ls ~/SM64Repos/")
202200

203-
numbCur += 1
201+
var numbCur = 0
204202

205-
if numbCur == 1 {
206-
execPath.append("-\(numbCur)")
207-
}
208-
else {
209-
execPath.removeLast()
203+
while checkExecPath!.contains(execPath) {
204+
205+
numbCur += 1
210206

211-
execPath.append(String(numbCur))
207+
if numbCur == 1 {
208+
execPath.append("-\(numbCur)")
209+
}
210+
else {
211+
execPath.removeLast()
212+
213+
execPath.append(String(numbCur))
214+
}
212215
}
213216
}
214217

@@ -408,21 +411,23 @@ struct RomView: View {
408411

409412
var execPath = "\(repo)-build"
410413

411-
let checkExecPath = try? shell.shell("ls ~/SM64Repos/")
412-
413-
var numbCur = 0
414-
415-
while checkExecPath!.contains(execPath) {
414+
if doKeepRepo {
415+
let checkExecPath = try? shell.shell("ls ~/SM64Repos/")
416416

417-
numbCur += 1
417+
var numbCur = 0
418418

419-
if numbCur == 1 {
420-
execPath.append("-\(numbCur)")
421-
}
422-
else {
423-
execPath.removeLast()
419+
while checkExecPath!.contains(execPath) {
424420

425-
execPath.append(String(numbCur))
421+
numbCur += 1
422+
423+
if numbCur == 1 {
424+
execPath.append("-\(numbCur)")
425+
}
426+
else {
427+
execPath.removeLast()
428+
429+
execPath.append(String(numbCur))
430+
}
426431
}
427432
}
428433

@@ -539,21 +544,23 @@ struct RomView: View {
539544

540545
var execPath = "\(repo)-build"
541546

542-
let checkExecPath = try? shell.shell("ls ~/SM64Repos/")
543-
544-
var numbCur = 0
545-
546-
while checkExecPath!.contains(execPath) {
547+
if doKeepRepo {
548+
let checkExecPath = try? shell.shell("ls ~/SM64Repos/")
547549

548-
numbCur += 1
550+
var numbCur = 0
549551

550-
if numbCur == 1 {
551-
execPath.append("-\(numbCur)")
552-
}
553-
else {
554-
execPath.removeLast()
552+
while checkExecPath!.contains(execPath) {
553+
554+
numbCur += 1
555555

556-
execPath.append(String(numbCur))
556+
if numbCur == 1 {
557+
execPath.append("-\(numbCur)")
558+
}
559+
else {
560+
execPath.removeLast()
561+
562+
execPath.append(String(numbCur))
563+
}
557564
}
558565
}
559566

@@ -670,23 +677,24 @@ struct RomView: View {
670677

671678
var execPath = "\(repo)-build"
672679

673-
let checkExecPath = try? shell.shell("ls ~/SM64Repos/")
674-
675-
print(checkExecPath)
676-
677-
var numbCur = 0
678-
679-
while checkExecPath!.contains(execPath) {
680+
if doKeepRepo {
680681

681-
numbCur += 1
682+
let checkExecPath = try? shell.shell("ls ~/SM64Repos/")
682683

683-
if numbCur == 1 {
684-
execPath.append("-\(numbCur)")
685-
}
686-
else {
687-
execPath.removeLast()
684+
var numbCur = 0
685+
686+
while checkExecPath!.contains(execPath) {
687+
688+
numbCur += 1
688689

689-
execPath.append(String(numbCur))
690+
if numbCur == 1 {
691+
execPath.append("-\(numbCur)")
692+
}
693+
else {
694+
execPath.removeLast()
695+
696+
execPath.append(String(numbCur))
697+
}
690698
}
691699
}
692700

@@ -744,6 +752,9 @@ struct RomView: View {
744752
Toggle(isOn: $doLauncher) {
745753
Text("Add Repo to Launcher")
746754
}
755+
Toggle(isOn: $doKeepRepo) {
756+
Text("Keep Repo (this setting only matters if you already compiled thos repo)")
757+
}
747758

748759
Picker("Compilation Speed", selection: $compSpeed) {
749760
Text("Slow")

0 commit comments

Comments
 (0)