mirror of
https://github.com/rfvgyhn/min-ed-launcher.git
synced 2025-10-29 11:36:22 +00:00
Merge branch 'steam-flatpaks'
# Conflicts: # CHANGELOG.md
This commit is contained in:
commit
abd4254130
10
CHANGELOG.md
10
CHANGELOG.md
@ -6,6 +6,16 @@
|
||||
- Log when using the fallback products directory in cases when user doesn't have permissions to write to default
|
||||
products directory ([#177])
|
||||
|
||||
- Add a workaround to get Flatpaks to be launched.
|
||||
You can now clear and override `$LD_LIBRARY_PATH` to allow processes defined in `processes` in your settings file to
|
||||
be launched using the host's libraries by setting `$MEL_LD_LIBRARY_PATH`. Mainly useful for Steam Deck users
|
||||
(i.e. auto-launching EDMC).
|
||||
|
||||
`konsole` Steam launch options example:
|
||||
```sh
|
||||
LD_LIBRARY_PATH="" konsole -e env MEL_LD_LIBRARY_PATH="$LD_LIBRARY_PATH" ./MinEdLauncher %command% /autorun /autoquit
|
||||
```
|
||||
|
||||
## [0.12.2] - 2025-07-25
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
10
README.md
10
README.md
@ -230,9 +230,17 @@ Linux: `$XDG_CONFIG_HOME/min-ed-launcher/settings.json` (`~/.config` if `$XDG_CO
|
||||
| gameStartDelay | Time to delay after starting processes but before starting ED. Defaults to zero |
|
||||
| shutdownDelay | Time to delay before closing processes. Defaults to zero |
|
||||
|
||||
When specifying a path for `gameLocation`, `cacheDir` or `processes.fileName` on Windows, it's required to escape backslashes. Make sure to use a
|
||||
> [!NOTE]
|
||||
> When specifying a path for `gameLocation`, `cacheDir` or `processes.fileName` on Windows, it's required to escape backslashes. Make sure to use a
|
||||
double backslash (`\\`) instead of a single backslash (`\`).
|
||||
|
||||
> [!NOTE]
|
||||
> Launching Flatpaks via `processes` through Steam requires resetting the LD_LIBRARY_PATH env var and setting
|
||||
> MEL_LD_LIBRARY_PATH to the host's LD_LIBRARY_PATH.
|
||||
> ```sh
|
||||
> LD_LIBRARY_PATH="" konsole -e env MEL_LD_LIBRARY_PATH="$LD_LIBRARY_PATH" ./MinEdLauncher %command% /autorun /autoquit
|
||||
> ```
|
||||
|
||||
```json
|
||||
{
|
||||
"apiUri": "https://api.zaonce.net",
|
||||
|
||||
@ -53,9 +53,9 @@
|
||||
<Compile Include="Types.fs" />
|
||||
<Compile Include="Http.fs" />
|
||||
<Compile Include="Github.fs" />
|
||||
<Compile Include="Process.fs" />
|
||||
<Compile Include="Product.fs" />
|
||||
<Compile Include="AuthorizedProduct.fs" />
|
||||
<Compile Include="Process.fs" />
|
||||
<Compile Include="Steam.fs" />
|
||||
<Compile Include="Cobra.fs" />
|
||||
<Compile Include="Api.fs" />
|
||||
|
||||
@ -45,4 +45,21 @@ let waitForExit (processes: Process list) =
|
||||
|> List.iter(fun p ->
|
||||
use p = p
|
||||
p.WaitForExit()
|
||||
)
|
||||
)
|
||||
|
||||
/// <summary>
|
||||
/// Override $LD_LIBRARY_PATH with $MEL_LIBRARY_PATH if it's set
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This allows things like flatpaks to run properly within Steam's runtime environment. Users can set
|
||||
/// $MEL_LD_LIBRARY_PATH to $LD_LIBRARY_PATH and then clear $LD_LIBRARY_PATH when launching so that only the game
|
||||
/// process get Steam's runtime environment's $LD_LIBRARY_PATH. Mostly useful for Steam Deck users
|
||||
/// </remarks>
|
||||
let overrideLdLibraryPath (startInfo: ProcessStartInfo) =
|
||||
System.Environment.GetEnvironmentVariable("MEL_LD_LIBRARY_PATH")
|
||||
|> Option.ofObj
|
||||
|> Option.iter(fun path ->
|
||||
Log.debug $"Setting $LD_LIBRARY_PATH to $MEL_LD_LIBRARY_PATH: {path}"
|
||||
startInfo.EnvironmentVariables["LD_LIBRARY_PATH"] <- path
|
||||
)
|
||||
startInfo
|
||||
@ -329,7 +329,7 @@ let createProcessInfo proton args product =
|
||||
|
||||
type RunResult = Ok of Process | AlreadyRunning | DryRun of ProcessStartInfo | Error of exn
|
||||
let run dryRun proton args (product:RunnableProduct) =
|
||||
let startInfo = createProcessInfo proton args product
|
||||
let startInfo = createProcessInfo proton args product |> Process.overrideLdLibraryPath
|
||||
|
||||
Log.debug $"Process: %s{startInfo.FileName} %s{startInfo.Arguments}"
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
<Compile Include="Extensions.fs" />
|
||||
<Compile Include="Settings.fs" />
|
||||
<Compile Include="Product.fs" />
|
||||
<Compile Include="Process.fs" />
|
||||
<Compile Include="EdLauncher.fs" />
|
||||
<Compile Include="Github.fs" />
|
||||
<Compile Include="MachineId.fs" />
|
||||
|
||||
43
tests/Process.fs
Normal file
43
tests/Process.fs
Normal file
@ -0,0 +1,43 @@
|
||||
module MinEdLauncher.Tests.Process
|
||||
|
||||
open System
|
||||
open System.Diagnostics
|
||||
open Expecto
|
||||
|
||||
[<Tests>]
|
||||
let tests =
|
||||
testList "Process" [
|
||||
let MEL_LIBRARY_PATH = "MEL_LD_LIBRARY_PATH"
|
||||
let LD_LIBRARY_PATH = "LD_LIBRARY_PATH"
|
||||
let overrideTests setup = [
|
||||
test "Sets LD_LIBRARY_PATH if MEL_LD_LIBRARY_PATH is set" {
|
||||
setup (fun () ->
|
||||
let startInfo = ProcessStartInfo()
|
||||
|
||||
Environment.SetEnvironmentVariable(MEL_LIBRARY_PATH, "test")
|
||||
MinEdLauncher.Process.overrideLdLibraryPath startInfo |> ignore
|
||||
|
||||
Expect.isTrue (startInfo.EnvironmentVariables.ContainsKey(LD_LIBRARY_PATH)) ""
|
||||
Expect.equal startInfo.EnvironmentVariables[LD_LIBRARY_PATH] "test" ""
|
||||
)
|
||||
}
|
||||
test "Doesn't set LD_LIBRARY_PATH if MEL_LD_LIBRARY_PATH is not set" {
|
||||
setup (fun () ->
|
||||
let startInfo = ProcessStartInfo()
|
||||
|
||||
MinEdLauncher.Process.overrideLdLibraryPath startInfo |> ignore
|
||||
|
||||
Expect.isFalse (startInfo.EnvironmentVariables.ContainsKey(LD_LIBRARY_PATH)) ""
|
||||
)
|
||||
}
|
||||
]
|
||||
overrideTests (fun test ->
|
||||
try
|
||||
test()
|
||||
finally
|
||||
Environment.SetEnvironmentVariable(MEL_LIBRARY_PATH, null)
|
||||
Environment.SetEnvironmentVariable(LD_LIBRARY_PATH, null)
|
||||
)
|
||||
|> testList "overrideLdLibraryPath"
|
||||
|> testSequenced
|
||||
]
|
||||
Loading…
x
Reference in New Issue
Block a user