File Browser/macOS: Don't treat .app as directory

While there are other bundles which show up as directories,
`.app` are the most common ones.

*Users should not be saving anything inside .app bundles, nor using
Blender to edit any of the files.
*This declutters the File Browser for say ~/Applications folder
or recursive search on a path with apps.
*Matches Finder's behavior of showing apps as files. (We don't have a
"right click > show package contents" button like Finder though)

This change shows `.app` files like incompatible files, or `.exe`s
on Windows.
{F8970986}

Reviewed By: #platform_macos, brecht, mont29

Differential Revision: https://developer.blender.org/D9162
This commit is contained in:
Ankit Meel 2020-10-09 16:49:03 +05:30
parent c4c8d855c6
commit 370ed6025f
Notes: blender-bot 2023-02-14 11:01:33 +01:00
Referenced by issue #82510, Can't use File Browser to define path to executable inside the .app contents on OSX
1 changed files with 5 additions and 1 deletions

View File

@ -2504,7 +2504,11 @@ static int filelist_readjob_list_dir(const char *root,
/* Set initial file type and attributes. */
entry->attributes = BLI_file_attributes(full_path);
if (S_ISDIR(files[i].s.st_mode)) {
if (S_ISDIR(files[i].s.st_mode)
#ifdef __APPLE__
&& !(ED_path_extension_type(full_path) & FILE_TYPE_APPLICATIONBUNDLE)
#endif
) {
entry->typeflag = FILE_TYPE_DIR;
}