Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docs/sphinx/reference-properties.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ Property Object Functions

Adds a 'path' property. Can be a directory or a file.

If target is a file path, the filters should be this format, separated by
double semicolons, and extensions separated by space::
If target is a file path or file save, the filters should be this format,
separated by double semicolons, and extensions separated by space::

"Example types 1 and 2 (*.ex1 *.ex2);;Example type 3 (*.ex3)"

Expand All @@ -187,9 +187,10 @@ Property Object Functions
- **OBS_PATH_DIRECTORY** - Directory

:param filter: If type is a file path, then describes the file filter
that the user can browse. Items are separated via
double semicolons. If multiple file types in a
filter, separate with space.
that the user can browse. If type is a save path,
then describes the file types the file can be
saved as. Items are separated via double semicolons.
Comment on lines +190 to +192

@PatTheMav PatTheMav Jun 1, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this functionality actually prohibit the user from choosing a custom filename with a different extension than the one provided by the filter?

I've seen multiple variants how save dialogs like this can behave, some just add the "correct" file extension to whatever the user provided (so if I choose to save a text file as test.jpg but the file format is "Plain Text" I end up with test.jpg.txt), others parse the file extension from the file name and block saving, yet others just ignore it completely and allow me to save a text file as test.jpg.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This opens a native dialog on all operating systems I think, so that's a concern of the OS

If multiple file types in a filter, separate with space.
:param default_path: The default path to start in, or *NULL*
:return: The property

Expand Down
2 changes: 1 addition & 1 deletion libobs/obs-properties.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ obs_property_t *obs_properties_add_path(obs_properties_t *props,
data->type = type;
data->default_path = bstrdup(default_path);

if (data->type == OBS_PATH_FILE)
if (data->type == OBS_PATH_FILE || data->type == OBS_PATH_FILE_SAVE)
data->filter = bstrdup(filter);

return p;
Expand Down