Skip to content

Commit

Permalink
Add some env variables to control Olympus behavior
Browse files Browse the repository at this point in the history
Mainly for use by the Nix package, but could probably come in handy for other packages as well.
  • Loading branch information
Popax21 committed Nov 22, 2024
1 parent 3ab5d06 commit 0648f20
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sharp/CmdInstallEverest.MiniInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ private void BootNative(MiniInstallerBridge bridge) {
RedirectStandardError = true,
CreateNoWindow = true,
}}) {
proc.HandleLaunchWrapper("MINIINSTALLER");

proc.OutputDataReceived += (o, e) => bridge.WriteLine(e.Data);
proc.ErrorDataReceived += (o, e) => bridge.WriteLine(e.Data);

Expand Down
2 changes: 2 additions & 0 deletions sharp/CmdLaunch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public override string Run(string root, string args, bool force) {
if (!string.IsNullOrEmpty(args))
game.StartInfo.Arguments = args;

game.HandleLaunchWrapper("CELESTE");

// Flatpak detection
// or string.Equals(Environment.GetEnvironmentVariable("container"), "flatpak");
if (File.Exists("/.flatpak-info")) {
Expand Down
1 change: 1 addition & 0 deletions sharp/CmdLaunchLoenn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public override string Run(string root) {

Console.Error.WriteLine($"Starting Loenn process: {loenn.StartInfo.FileName} {loenn.StartInfo.Arguments} (in {root})");

loenn.HandleLaunchWrapper("LOENN");
loenn.Start();
return null;
}
Expand Down
10 changes: 10 additions & 0 deletions sharp/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Threading.Tasks;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.ObjectFactories;
Expand All @@ -17,5 +18,14 @@ public static bool ReadLineUntil(this TextReader reader, string wanted) {
return false;
}

public static void HandleLaunchWrapper(this Process proc, string wrapperName) {
// Handle launch wrappers
string wrapper = Environment.GetEnvironmentVariable($"OLYMPUS_{wrapperName}_WRAPPER");
if (!string.IsNullOrEmpty(wrapper)) {
proc.StartInfo.Arguments = $"{proc.StartInfo.FileName} {proc.StartInfo.Arguments}";
proc.StartInfo.FileName = wrapper;
}
}

}
}
2 changes: 1 addition & 1 deletion src/modinstaller.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function modinstaller.register()
return false

elseif userOS == "Linux" then
if fs.isFile("/.flatpak-info") then
if fs.isFile("/.flatpak-info") or os.getEnv("OLYMPUS_SKIP_SCHEME_HANDLER_CHECK") == "1" then
return false
end

Expand Down

0 comments on commit 0648f20

Please sign in to comment.