1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-30 10:44:37 +00:00

opening and selecting specific file

This commit is contained in:
Cameron Taylor 2023-11-23 19:54:34 -05:00
parent 2d33461a24
commit a2ce1fdd5e

View file

@ -53,6 +53,26 @@ class WindowUtil
#end #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. * Dispatched when the game window is closed.
*/ */