Skip to content

Commit c4d4cc2

Browse files
committed
Mac sandboxing, fix crash
*.entitlements + create entitlements for mac sandboxing - read only access FolderDisplay.cpp + restore IsOk safety check form.fpb, interface.cpp + add tooltips to primary buttons interface_derived.cpp + clear previous selection when sizing a new folder
1 parent c17f212 commit c4d4cc2

7 files changed

Lines changed: 67 additions & 4 deletions

File tree

FatFileFinder Dynamic.entitlements

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.assets.movies.read-only</key>
8+
<true/>
9+
<key>com.apple.security.assets.music.read-only</key>
10+
<true/>
11+
<key>com.apple.security.assets.pictures.read-only</key>
12+
<true/>
13+
<key>com.apple.security.files.downloads.read-only</key>
14+
<true/>
15+
<key>com.apple.security.files.user-selected.read-only</key>
16+
<true/>
17+
<key>com.apple.security.personal-information.addressbook</key>
18+
<true/>
19+
<key>com.apple.security.personal-information.calendars</key>
20+
<true/>
21+
<key>com.apple.security.personal-information.location</key>
22+
<true/>
23+
</dict>
24+
</plist>

FatFileFinder.entitlements

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.assets.movies.read-only</key>
8+
<true/>
9+
<key>com.apple.security.assets.music.read-only</key>
10+
<true/>
11+
<key>com.apple.security.assets.pictures.read-only</key>
12+
<true/>
13+
<key>com.apple.security.files.downloads.read-only</key>
14+
<true/>
15+
<key>com.apple.security.files.user-selected.read-only</key>
16+
<true/>
17+
<key>com.apple.security.personal-information.addressbook</key>
18+
<true/>
19+
<key>com.apple.security.personal-information.calendars</key>
20+
<true/>
21+
<key>com.apple.security.personal-information.location</key>
22+
<true/>
23+
</dict>
24+
</plist>

mac.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@
238238
41B5AAEC22DB8BB300347CC8 /* interface.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = interface.cpp; sourceTree = "<group>"; };
239239
41B5AAED22DB8BB400347CC8 /* interface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = interface.h; sourceTree = "<group>"; };
240240
AA012113224C24D4000F4F82 /* wxmac.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = wxmac.icns; sourceTree = "<group>"; };
241+
AA04140923FC927700EE539B /* FatFileFinder.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = FatFileFinder.entitlements; sourceTree = "<group>"; };
242+
AA04140A23FC92C200EE539B /* FatFileFinder Dynamic.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "FatFileFinder Dynamic.entitlements"; sourceTree = "<group>"; };
241243
AA0A148123CCBE410092E9AA /* DirectoryData.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryData.cpp; sourceTree = "<group>"; };
242244
AA0A148223CCBE410092E9AA /* DirectoryData.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = DirectoryData.hpp; sourceTree = "<group>"; };
243245
AA1D0F4E222A09A600678304 /* FatFileFinder Dynamic.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "FatFileFinder Dynamic.app"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -312,6 +314,8 @@
312314
AA1D0F45222A09A600678304 = {
313315
isa = PBXGroup;
314316
children = (
317+
AA04140A23FC92C200EE539B /* FatFileFinder Dynamic.entitlements */,
318+
AA04140923FC927700EE539B /* FatFileFinder.entitlements */,
315319
AA1D0F50222A09A600678304 /* source */,
316320
AA1D0F4F222A09A600678304 /* Products */,
317321
AA14A0F2222A1219002C4553 /* Frameworks */,
@@ -838,6 +842,7 @@
838842
AA1D0F60222A09A800678304 /* Debug */ = {
839843
isa = XCBuildConfiguration;
840844
buildSettings = {
845+
CODE_SIGN_ENTITLEMENTS = "FatFileFinder Dynamic.entitlements";
841846
CODE_SIGN_STYLE = Automatic;
842847
COMBINE_HIDPI_IMAGES = YES;
843848
INFOPLIST_FILE = "$(SRCROOT)/source/Info_cocoa.plist";
@@ -854,6 +859,7 @@
854859
AA1D0F61222A09A800678304 /* Release */ = {
855860
isa = XCBuildConfiguration;
856861
buildSettings = {
862+
CODE_SIGN_ENTITLEMENTS = "FatFileFinder Dynamic.entitlements";
857863
CODE_SIGN_STYLE = Automatic;
858864
COMBINE_HIDPI_IMAGES = YES;
859865
INFOPLIST_FILE = "$(SRCROOT)/source/Info_cocoa.plist";
@@ -870,6 +876,7 @@
870876
AAD015CB222B2FE300E25CB7 /* Debug */ = {
871877
isa = XCBuildConfiguration;
872878
buildSettings = {
879+
CODE_SIGN_ENTITLEMENTS = FatFileFinder.entitlements;
873880
CODE_SIGN_STYLE = Automatic;
874881
COMBINE_HIDPI_IMAGES = YES;
875882
HEADER_SEARCH_PATHS = (
@@ -899,6 +906,7 @@
899906
AAD015CC222B2FE300E25CB7 /* Release */ = {
900907
isa = XCBuildConfiguration;
901908
buildSettings = {
909+
CODE_SIGN_ENTITLEMENTS = FatFileFinder.entitlements;
902910
CODE_SIGN_STYLE = Automatic;
903911
COMBINE_HIDPI_IMAGES = YES;
904912
HEADER_SEARCH_PATHS = (

source/FolderDisplay.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ void FolderDisplay::OnUpdateUI(wxCommandEvent& event){
321321
AddItem(file);
322322
}
323323
//reconnect if applicable
324-
if (reloadParent != nullptr /*&& updateItem.IsOk()*/){
324+
if (reloadParent != nullptr && updateItem.IsOk()){
325325
reloadParent->SetItemData(updateItem, fd);
326326
data->recalculateStats();
327327
reloadParent->SetItemText(sizeToString(fd->size), reloadParent->ItemToRow(updateItem), 2);

source/form.fbp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@
324324
<property name="style">wxBU_EXACTFIT</property>
325325
<property name="subclass">; ; forward_declare</property>
326326
<property name="toolbar_pane">0</property>
327-
<property name="tooltip"></property>
327+
<property name="tooltip">Open a folder and calculate its size</property>
328328
<property name="validator_data_type"></property>
329329
<property name="validator_style">wxFILTER_NONE</property>
330330
<property name="validator_type">wxDefaultValidator</property>
@@ -399,7 +399,7 @@
399399
<property name="style">wxBU_EXACTFIT</property>
400400
<property name="subclass">; ; forward_declare</property>
401401
<property name="toolbar_pane">0</property>
402-
<property name="tooltip"></property>
402+
<property name="tooltip">Select a folder from the list and re-calculate its size</property>
403403
<property name="validator_data_type"></property>
404404
<property name="validator_style">wxFILTER_NONE</property>
405405
<property name="validator_type">wxDefaultValidator</property>
@@ -474,7 +474,7 @@
474474
<property name="style">wxBU_EXACTFIT</property>
475475
<property name="subclass">; ; forward_declare</property>
476476
<property name="toolbar_pane">0</property>
477-
<property name="tooltip"></property>
477+
<property name="tooltip">Stop the current size operation</property>
478478
<property name="validator_data_type"></property>
479479
<property name="validator_style">wxFILTER_NONE</property>
480480
<property name="validator_type">wxDefaultValidator</property>

source/interface.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,18 @@ MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& t
7777
toolbarSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
7878

7979
openFolderBtn = new wxButton( this, wxID_OPEN, wxT("📂"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
80+
openFolderBtn->SetToolTip( wxT("Open a folder and calculate its size") );
81+
8082
toolbarSizer->Add( openFolderBtn, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_BOTTOM, 5 );
8183

8284
reloadFolderBtn = new wxButton( this, wxID_REFRESH, wxT("🔄"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
85+
reloadFolderBtn->SetToolTip( wxT("Select a folder from the list and re-calculate its size") );
86+
8387
toolbarSizer->Add( reloadFolderBtn, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_BOTTOM, 5 );
8488

8589
stopSizeBtn = new wxButton( this, wxID_STOP, wxT("🛑"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
90+
stopSizeBtn->SetToolTip( wxT("Stop the current size operation") );
91+
8692
toolbarSizer->Add( stopSizeBtn, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_BOTTOM, 5 );
8793

8894
progressBar = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL );

source/interface_derived.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ void MainFrame::SizeRootFolder(const string& folder){
111111
}
112112

113113
userClosedLog = false;
114+
selected = nullptr;
114115

115116
progCallback callback = [&](float progress, DirectoryData* data){
116117
wxCommandEvent event(progEvt);

0 commit comments

Comments
 (0)