open recent on welcome screen

This commit is contained in:
Cameron Taylor 2023-11-21 15:23:24 -05:00
parent 64b028baee
commit 25a66ddbfe

View file

@ -101,7 +101,13 @@ class ChartEditorDialogHandler
if (chartPath == null) continue;
var linkRecentChart:Link = new Link();
linkRecentChart.text = chartPath;
// regex to only use the filename, not the full path
// "dadbattle.fnc" insted of "c:/user/docs/funkin/dadbattle.fnc"
// hovering tooltip shows full path
var fileNamePattern:EReg = new EReg("([^/\\\\]+)$", "");
var fileName:String = fileNamePattern.match(chartPath) ? fileNamePattern.matched(1) : chartPath;
linkRecentChart.text = fileName;
linkRecentChart.tooltip = chartPath;
linkRecentChart.onClick = function(_event) {
dialog.hideDialog(DialogButton.CANCEL);
state.stopWelcomeMusic();