fix xdg-open in NixOS (#426)

since `/usr/bin/xdg-open` isn't an actual path in NixOS, it's actually BETTER to just invoke `xdg-open` without the full path
This commit is contained in:
crowplexus
2024-11-03 14:01:56 +01:00
committed by GitHub
parent 04e1763d25
commit 796d585f9c
2 changed files with 8 additions and 2 deletions
+4 -1
View File
@@ -706,7 +706,10 @@ class CoolUtil
*/
@:noUsing public static inline function openURL(url:String) {
#if linux
Sys.command('/usr/bin/xdg-open', [url]);
// generally `xdg-open` should work in every distro
var cmd = Sys.command("xdg-open", [url]);
// run old command JUST IN CASE it fails, which it shouldn't
if (cmd != 0) cmd = Sys.command("/usr/bin/xdg-open", [url]);
#else
FlxG.openURL(url);
#end
+4 -1
View File
@@ -304,7 +304,10 @@ class System
#elseif mac
Sys.command("/usr/bin/open", [path]);
#elseif linux
Sys.command("/usr/bin/xdg-open", [path, "&"]);
// generally `xdg-open` should work in every distro
var cmd = Sys.command("xdg-open", [path, "&"]);
// run old command JUST IN CASE it fails, which it shouldn't
if (cmd != 0) cmd = Sys.command("/usr/bin/xdg-open", [path, "&"]);
#elseif (js && html5)
Browser.window.open(path, "_blank");
#elseif flash