Skip to content

Commit

Permalink
Calculate working directory for projects based on launch profile
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelldi committed Dec 4, 2024
1 parent fa72dda commit b6f4769
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

- [#119](https://github.com/JetBrains/aspire-plugin/issues/119): Colors in Aspire logs are missing
- [#306](https://github.com/JetBrains/aspire-plugin/issues/306): Can run AppHost under .NET 9
- [#304](https://github.com/JetBrains/aspire-plugin/issues/304): Starting console application project resource does not honor `workingDirectory` option of the launch profile

## [1.6.6] - 2024-11-22

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.jetbrains.rider.aspire.run

import com.intellij.util.execution.ParametersListUtil
import com.intellij.util.io.systemIndependentPath
import com.jetbrains.rider.aspire.util.MSBuildPropertyService.ProjectRunProperties
import com.jetbrains.rider.model.ProjectOutput
import com.jetbrains.rider.run.configurations.launchSettings.LaunchSettingsJson

Expand All @@ -22,6 +24,10 @@ internal fun getWorkingDirectory(profile: LaunchSettingsJson.Profile?, projectOu
return profile?.workingDirectory ?: projectOutput?.workingDirectory ?: ""
}

internal fun getWorkingDirectory(profile: LaunchSettingsJson.Profile?, projectProperties: ProjectRunProperties?): String {
return profile?.workingDirectory ?: projectProperties?.workingDirectory?.systemIndependentPath ?: ""
}

internal fun getEnvironmentVariables(
profileName: String?,
profile: LaunchSettingsJson.Profile?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.intellij.util.io.systemIndependentPath
import com.jetbrains.rider.aspire.generated.SessionEnvironmentVariable
import com.jetbrains.rider.aspire.generated.SessionModel
import com.jetbrains.rider.aspire.run.AspireHostConfiguration
import com.jetbrains.rider.aspire.run.getWorkingDirectory
import com.jetbrains.rider.aspire.settings.AspireSettings
import com.jetbrains.rider.aspire.util.MSBuildPropertyService
import com.jetbrains.rider.aspire.util.getStartBrowserAction
Expand Down Expand Up @@ -70,7 +71,7 @@ class SessionExecutableFactory(private val project: Project) {
val output = runnableProject.projectOutputs.firstOrNull() ?: return null
val launchProfile = getLaunchProfile(sessionModel, runnableProject)
val executablePath = output.exePath
val workingDirectory = output.workingDirectory
val workingDirectory = getWorkingDirectory(launchProfile, output)
val arguments = mergeArguments(sessionModel.args, output.defaultArguments, launchProfile?.commandLineArgs)
val envs = mergeEnvironmentVariables(sessionModel.envs, launchProfile?.environmentVariables)

Expand Down Expand Up @@ -133,7 +134,7 @@ class SessionExecutableFactory(private val project: Project) {
val properties = propertyService.getProjectRunProperties(sessionProjectPath) ?: return null
val launchProfile = getLaunchProfile(sessionModel, sessionProjectPath)
val executablePath = properties.executablePath.systemIndependentPath
val workingDirectory = properties.workingDirectory.systemIndependentPath
val workingDirectory = getWorkingDirectory(launchProfile, properties)
val arguments = mergeArguments(sessionModel.args, properties.arguments, launchProfile?.commandLineArgs)
val envs = mergeEnvironmentVariables(sessionModel.envs, launchProfile?.environmentVariables)

Expand Down

0 comments on commit b6f4769

Please sign in to comment.