mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-23 08:07:54 -05:00
opening and selecting specific file
This commit is contained in:
parent
2d33461a24
commit
a2ce1fdd5e
1 changed files with 20 additions and 0 deletions
|
@ -53,6 +53,26 @@ class WindowUtil
|
|||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs platform-specific code to open a file explorer and select a specific file.
|
||||
* @param targetPath The path of the file to select.
|
||||
*/
|
||||
public static function openSelectFile(targetPath:String):Void
|
||||
{
|
||||
#if CAN_OPEN_LINKS
|
||||
#if windows
|
||||
Sys.command('explorer', ["/select," + targetPath.replace("/", "\\")]);
|
||||
#elseif mac
|
||||
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]);
|
||||
#end
|
||||
#else
|
||||
throw 'Cannot open URLs on this platform.';
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatched when the game window is closed.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue