Page 1 of 1

Local File System access, File Browsers and Messageboxes?

Posted: Sat Feb 01, 2025 7:53 am
by dcuny
I had a look at the source code for Window.h, and see there's a structure for message boxes and file dialogs:

Code: Select all

struct MessageBoxData
{
	MessageBoxType type;
	std::string title;
	std::string message;
	std::vector<std::string> buttons;
	int enterButtonIndex;
	int escapeButtonIndex;
	bool attachToWindow;
};
as well as File Dialogs:

Code: Select all

struct FileDialogData
{
	FileDialogType type;
	std::string title;
	std::string acceptLabel;
	std::string cancelLabel;
	std::string defaultName;
	std::vector<FileDialogFilter> filters;
	bool multiSelect;
	bool attachToWindow;
};
There are hooks as well:

Code: Select all

virtual bool showMessageBox(const std::string &title, const std::string &message, MessageBoxType type, bool attachtowindow) = 0;
virtual int showMessageBox(const MessageBoxData &data) = 0;
virtual void showFileDialog(const FileDialogData &data, FileDialogCallback callback, void *context) = 0;
I see the love.window.shoMessageBox is exposed, but I don't see love.window.showFileDialog.

Is there an intent to add a native file dialog? I'm aware of the numerous other options, as well as the issues with getting native dialogs to play nice with the Love file system.

I assume that it would be limited to the Love file system, but I ran across a mention of native file system support (which I can't seem to find) as a method reserved for future use.

Is the showFileDialog a vestige of a failed attempt, or something that might be added?

Re: Local File System access, File Browsers and Messageboxes?

Posted: Sat Feb 01, 2025 9:17 am
by pgimeno
It might well be that love 12.0 will include it, as that feature is new in SDL 3 which was just released a few days ago.

Re: Local File System access, File Browsers and Messageboxes?

Posted: Sat Feb 01, 2025 3:36 pm
by slime
https://love2d.org/wiki/12.0

You're looking at the 12.0 source code. You can download nightly builds if you want, via the Github Actions page.

Re: Local File System access, File Browsers and Messageboxes?

Posted: Sat Feb 01, 2025 6:21 pm
by dusoft
slime wrote: Sat Feb 01, 2025 3:36 pm https://love2d.org/wiki/12.0

You're looking at the 12.0 source code. You can download nightly builds if you want, via the Github Actions page.
Sorry for off-topic, but seeing this: "Added support for launching a specific .lua file as the main file." Just great!

Re: Local File System access, File Browsers and Messageboxes?

Posted: Sat Feb 01, 2025 7:07 pm
by dcuny
pgimeno wrote: Sat Feb 01, 2025 9:17 am It might well be that love 12.0 will include it, as that feature is new in SDL 3 which was just released a few days ago.
Ah, thanks! :awesome:

Re: Local File System access, File Browsers and Messageboxes?

Posted: Sat Feb 01, 2025 7:10 pm
by dcuny
slime wrote: Sat Feb 01, 2025 3:36 pm https://love2d.org/wiki/12.0

You're looking at the 12.0 source code. You can download nightly builds if you want, via the Github Actions page.
That explains a lot. I just did a search for "love2d source code" and didn't pay enough attention to where I ended up. :crazy:

I was wondering how I ran across love.filesystem.openNativeFile earlier.

Thanks!