From 78c3ef2ebbb2e08bbb5fddeb12319a9daefb0306 Mon Sep 17 00:00:00 2001 From: oneeyeman1 Date: Sun, 11 Aug 2019 19:46:25 -0500 Subject: [PATCH] Implement support for wxFD_NO_FOLLOW in wxMac Disable aliases resolving in standard file dialogs if this flag is specified. Closes https://github.com/wxWidgets/wxWidgets/pull/1479 --- interface/wx/filedlg.h | 3 ++- src/osx/cocoa/filedlg.mm | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/interface/wx/filedlg.h b/interface/wx/filedlg.h index 022686a6b8..9a0e60efd8 100644 --- a/interface/wx/filedlg.h +++ b/interface/wx/filedlg.h @@ -124,7 +124,8 @@ const char wxFileSelectorDefaultWildcardStr[]; @style{wxFD_NO_FOLLOW} Directs the dialog to return the path and file name of the selected shortcut file, not its target as it does by default. Currently this - flag is only implemented in wxMSW and the non-dereferenced link path + flag is only implemented in wxMSW and wxOSX (where it prevents + aliases from being resolved). The non-dereferenced link path is always returned, even without this flag, under Unix and so using it there doesn't do anything. This flag was added in wxWidgets 3.1.0. diff --git a/src/osx/cocoa/filedlg.mm b/src/osx/cocoa/filedlg.mm index 6a43696b12..e31aa828a7 100644 --- a/src/osx/cocoa/filedlg.mm +++ b/src/osx/cocoa/filedlg.mm @@ -350,7 +350,7 @@ void wxFileDialog::ShowWindowModal() [oPanel setTreatsFilePackagesAsDirectories:NO]; [oPanel setCanChooseDirectories:NO]; - [oPanel setResolvesAliases:YES]; + [oPanel setResolvesAliases:HasFlag(wxFD_NO_FOLLOW) ? NO : YES]; [oPanel setCanChooseFiles:YES]; [oPanel setMessage:cf.AsNSString()]; [oPanel setAllowsMultipleSelection: (HasFlag(wxFD_MULTIPLE) ? YES : NO )]; @@ -608,7 +608,7 @@ int wxFileDialog::ShowModal() [oPanel setTreatsFilePackagesAsDirectories:NO]; [oPanel setCanChooseDirectories:NO]; - [oPanel setResolvesAliases:YES]; + [oPanel setResolvesAliases:HasFlag(wxFD_NO_FOLLOW) ? NO : YES]; [oPanel setCanChooseFiles:YES]; [oPanel setMessage:cf.AsNSString()]; [oPanel setAllowsMultipleSelection: (HasFlag(wxFD_MULTIPLE) ? YES : NO )];