From aafdbfd083af20e92a9b344973a49c5af5609b12 Mon Sep 17 00:00:00 2001 From: CharlesCatYT Date: Mon, 30 Sep 2024 18:09:05 -0400 Subject: [PATCH] little bit of linux shits --- source/funkin/util/FileUtil.hx | 6 +++--- source/funkin/util/WindowUtil.hx | 24 ++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/source/funkin/util/FileUtil.hx b/source/funkin/util/FileUtil.hx index e8211484..9e4be409 100644 --- a/source/funkin/util/FileUtil.hx +++ b/source/funkin/util/FileUtil.hx @@ -663,10 +663,10 @@ class FileUtil // FileUtil.hx note: this was originally used to open the logs specifically! // thats why the above comment is there! Sys.command('open', [pathFolder]); + #elseif linux + // Can't use args parameter or else & gets treated incorrectly + Sys.command('xdg-open $pathFolder &'); #end - - // TODO: implement linux - // some shit with xdg-open :thinking: emoji... } static function convertTypeFilter(typeFilter:Array):String diff --git a/source/funkin/util/WindowUtil.hx b/source/funkin/util/WindowUtil.hx index 1c8446b3..17d7f715 100644 --- a/source/funkin/util/WindowUtil.hx +++ b/source/funkin/util/WindowUtil.hx @@ -46,7 +46,7 @@ class WindowUtil #elseif mac Sys.command('open', [targetPath]); #elseif linux - Sys.command('open', [targetPath]); + Sys.command('xdg-open $pathFolder &'); #end #else throw 'Cannot open URLs on this platform.'; @@ -66,7 +66,17 @@ class WindowUtil Sys.command('open', ['-R', targetPath]); #elseif linux // TODO: unsure of the linux equivalent to opening a folder and then "selecting" a file. - Sys.command('open', [targetPath]); + // Sys.command('open', [targetPath]); + + // TODO: Is this consistent across distros? + Sys.command('dbus-send', [ + '--session', + '--print-reply', + '--dest=org.freedesktop.FileManager1', + '--type=method_call /org/freedesktop/FileManager1', + 'org.freedesktop.FileManager1.ShowItems array:string:"file://$targetPath"', + 'string:""' + ]); #end #else throw 'Cannot open URLs on this platform.'; @@ -124,4 +134,14 @@ class WindowUtil { lime.app.Application.current.window.title = value; } + + /** + * Shows a message box if supported and logs message to the console + */ + public static function showMessageBox(message:Null, title:Null):Void + { + trace('[$title] $message'); + + lime.app.Application.current.window.alert(message, title); + } }