Fix T89129: file dialog displays in-progress Safari downloads as a folder

In-progress Safari download files/packages are now recognized as bundles
and therefore not treated as directories.

Differential Revision: https://developer.blender.org/D11613
This commit is contained in:
Leon Zandman
2021-06-24 19:03:51 +02:00
committed by Brecht Van Lommel
parent 15868b1ff4
commit beb6399ae5
2 changed files with 12 additions and 5 deletions

View File

@@ -1191,7 +1191,7 @@ static int filelist_geticon_ex(const FileDirEntry *file,
if (FILENAME_IS_PARENT(file->relpath)) {
return is_main ? ICON_FILE_PARENT : ICON_NONE;
}
if (typeflag & FILE_TYPE_APPLICATIONBUNDLE) {
if (typeflag & FILE_TYPE_BUNDLE) {
return ICON_UGLYPACKAGE;
}
if (typeflag & FILE_TYPE_BLENDER) {
@@ -2519,9 +2519,16 @@ int ED_path_extension_type(const char *path)
if (file_is_blend_backup(path)) {
return FILE_TYPE_BLENDER_BACKUP;
}
if (BLI_path_extension_check(path, ".app")) {
return FILE_TYPE_APPLICATIONBUNDLE;
#ifdef __APPLE__
if (BLI_path_extension_check_n(path,
/* Application bundle */
".app",
/* Safari in-progress/paused download */
".download",
NULL)) {
return FILE_TYPE_BUNDLE;
}
#endif
if (BLI_path_extension_check(path, ".py")) {
return FILE_TYPE_PYSCRIPT;
}
@@ -2815,7 +2822,7 @@ static int filelist_readjob_list_dir(const char *root,
entry->attributes = BLI_file_attributes(full_path);
if (S_ISDIR(files[i].s.st_mode)
#ifdef __APPLE__
&& !(ED_path_extension_type(full_path) & FILE_TYPE_APPLICATIONBUNDLE)
&& !(ED_path_extension_type(full_path) & FILE_TYPE_BUNDLE)
#endif
) {
entry->typeflag = FILE_TYPE_DIR;

View File

@@ -1019,7 +1019,7 @@ typedef enum eFileSel_File_Types {
FILE_TYPE_COLLADA = (1 << 13),
/** from filter_glob operator property */
FILE_TYPE_OPERATOR = (1 << 14),
FILE_TYPE_APPLICATIONBUNDLE = (1 << 15),
FILE_TYPE_BUNDLE = (1 << 15),
FILE_TYPE_ALEMBIC = (1 << 16),
/** For all kinds of recognized import/export formats. No need for specialized types. */
FILE_TYPE_OBJECT_IO = (1 << 17),