Skip to content

Commit 69bfa86

Browse files
author
caleb
committed
Get debug working on linux
1 parent 9c14a47 commit 69bfa86

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/rider/main/kotlin/run/RunConfiguration.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,22 @@ class RunConfiguration(project: Project, factory: ConfigurationFactory, name: St
122122
private fun getRimworldState(environment: ExecutionEnvironment, debugInLinux: Boolean = false): CommandLineState {
123123
return object : CommandLineState(environment) {
124124
override fun startProcess(): ProcessHandler {
125-
var pathToRun = getScriptName()
126-
var arguments = getCommandLineOptions()
125+
val rimworldPath = getScriptName()
126+
var pathToRun = rimworldPath
127+
// Splitting on space will be a source of future bugs. In the future the arguments should be List as early as possible
128+
val arguments = getCommandLineOptions().split(' ').filter { it.isNotEmpty() }.toMutableList()
127129

128130
// If we're debugging in Rimworld, instead of /pwd/RimWorldLinux ...args we want to run /bin/sh /pwd/run.sh /pwd/RimWorldLinux ...args
129131
if (debugInLinux) {
130-
val bashScriptPath = "${Path(pathToRun).parent}/run.sh"
131-
arguments = "$bashScriptPath $pathToRun $arguments"
132132
pathToRun = "/bin/sh"
133+
val bashScriptPath = "${Path(rimworldPath).parent}/run.sh"
134+
arguments.add(0, bashScriptPath)
133135
}
134136

137+
println("Calling $pathToRun with arguments ${arguments.joinToString(" ")} with working directory ${Path(rimworldPath).parent}")
135138
val commandLine = GeneralCommandLine(pathToRun)
136-
.withParameters(arguments.split(' ').filter { it.isNotEmpty() })
139+
.withParameters(arguments)
140+
.withWorkingDirectory(Path(rimworldPath).parent)
137141

138142
EnvironmentVariablesData.create(getEnvData(), true).configureCommandLine(commandLine, true)
139143

src/rider/main/resources/UnityDoorstop/Linux/run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ enabled="1"
2323

2424
# Path to the assembly to load and execute
2525
# NOTE: The entrypoint must be of format `static void Doorstop.Entrypoint.Start()`
26-
target_assembly="Doorstop.dll"
26+
target_assembly="Doorstop/Doorstop.dll"
2727

2828
# Overrides the default boot.config file path
2929
boot_config_override=
@@ -277,4 +277,4 @@ else
277277
fi
278278

279279
# shellcheck disable=SC2086
280-
exec "$executable_path" $rest_args
280+
exec "$executable_path" $rest_args | tee -a debug.log

0 commit comments

Comments
 (0)