Local File System access, File Browsers and Messageboxes?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
dcuny
Prole
Posts: 17
Joined: Wed Aug 04, 2021 1:19 am

Local File System access, File Browsers and Messageboxes?

Post 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?
User avatar
pgimeno
Party member
Posts: 3709
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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.
User avatar
slime
Solid Snayke
Posts: 3179
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post 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.
User avatar
dusoft
Party member
Posts: 765
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

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

Post 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!
dcuny
Prole
Posts: 17
Joined: Wed Aug 04, 2021 1:19 am

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

Post 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:
dcuny
Prole
Posts: 17
Joined: Wed Aug 04, 2021 1:19 am

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

Post 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!
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Semrush [Bot] and 1 guest