macOS/File Browser: Support external operations #107267

Open
Ankit Meel wants to merge 10 commits from ankitm/blender:ankitm/finderreveal into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
3 changed files with 10 additions and 4 deletions
Showing only changes of commit 94d1988e40 - Show all commits

View File

@ -55,6 +55,8 @@ static char *windows_operation_string(FileExternalOperation operation)
return "open";
case FILE_EXTERNAL_OPERATION_FOLDER_OPEN:
return "open";
case FILE_EXTERNAL_OPERATION_FILE_REVEAL:
return NULL;
case FILE_EXTERNAL_OPERATION_EDIT:
return "edit";
case FILE_EXTERNAL_OPERATION_NEW:
@ -83,7 +85,7 @@ static char *windows_operation_string(FileExternalOperation operation)
return "cmd";
}
BLI_assert_unreachable();
return "";
return NULL;
}
#endif

View File

@ -203,6 +203,9 @@ static bool BLI_windows_file_operation_is_registered(const char *extension, cons
bool BLI_windows_external_operation_supported(const char *filepath, const char *operation)
{
if (!operation) {
return false;
}
if (STREQ(operation, "open") || STREQ(operation, "properties")) {
return true;
}

View File

@ -1787,7 +1787,7 @@ static const EnumPropertyItem file_external_operation[] = {
"Reveal in Finder",
"Reveal this folder in a new Finder window"
#else
"Reveal in File Explorer",
"Open in File Explorer",
"Open this folder in a system file browser"
ankitm marked this conversation as resolved Outdated

“in a system file browser“

“in **a** system file browser“
#endif
},
@ -1798,8 +1798,8 @@ static const EnumPropertyItem file_external_operation[] = {
"Reveal in Finder",
"Reveal this file in a new Finder window"
#else
"Reveal in File Explorer",
"Reveal this file in a system file browser"
"Open in File Explorer",
"Open this file in a system file browser"
#endif
},
{FILE_EXTERNAL_OPERATION_EDIT, "EDIT", ICON_NONE, "Edit", "Edit this file"},
@ -2002,6 +2002,7 @@ static void file_os_operations_menu_draw(const bContext *C_const, Menu *menu)
file_os_operations_menu_item(layout, ot, path, FILE_EXTERNAL_OPERATION_PRINT);
file_os_operations_menu_item(layout, ot, path, FILE_EXTERNAL_OPERATION_INSTALL);
file_os_operations_menu_item(layout, ot, path, FILE_EXTERNAL_OPERATION_RUNAS);
file_os_operations_menu_item(layout, ot, root, FILE_EXTERNAL_OPERATION_FOLDER_OPEN);
file_os_operations_menu_item(layout, ot, path, FILE_EXTERNAL_OPERATION_FILE_REVEAL);
file_os_operations_menu_item(layout, ot, root, FILE_EXTERNAL_OPERATION_FOLDER_TERMINAL);
file_os_operations_menu_item(layout, ot, path, FILE_EXTERNAL_OPERATION_PROPERTIES);