Fix #143939: Fix Win32 External Ops, Open Folder/CMD for Files

File Browser list, Context Menu, External. On Win32 for items that are
not folders we need to use the list root for "open folder" and for
"command prompt here".

Pull Request: https://projects.blender.org/blender/blender/pulls/143964
This commit is contained in:
Harley Acheson
2025-08-05 00:11:33 +02:00
committed by Harley Acheson
parent a007c309b3
commit 283bc177a4

View File

@@ -1865,6 +1865,17 @@ static wmOperatorStatus file_external_operation_exec(bContext *C, wmOperator *op
#ifdef WIN32
const FileExternalOperation operation = (FileExternalOperation)RNA_enum_get(op->ptr,
"operation");
if (!(fileentry->typeflag & FILE_TYPE_DIR) &&
ELEM(operation, FILE_EXTERNAL_OPERATION_FOLDER_OPEN, FILE_EXTERNAL_OPERATION_FOLDER_CMD))
{
/* Not a folder path, so for these operations use the root. */
const char *root = filelist_dir(sfile->files);
if (BLI_file_external_operation_execute(root, operation)) {
WM_cursor_set(CTX_wm_window(C), WM_CURSOR_DEFAULT);
return OPERATOR_FINISHED;
}
}
if (BLI_file_external_operation_execute(filepath, operation)) {
WM_cursor_set(CTX_wm_window(C), WM_CURSOR_DEFAULT);
return OPERATOR_FINISHED;