Skip to content

Commit

Permalink
little bit of linux shits
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesisfeline committed Sep 30, 2024
1 parent 3652896 commit aafdbfd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
6 changes: 3 additions & 3 deletions source/funkin/util/FileUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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<FileFilter>):String
Expand Down
24 changes: 22 additions & 2 deletions source/funkin/util/WindowUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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.';
Expand All @@ -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.';
Expand Down Expand Up @@ -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<String>, title:Null<String>):Void
{
trace('[$title] $message');

lime.app.Application.current.window.alert(message, title);
}
}

0 comments on commit aafdbfd

Please sign in to comment.