Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent errors in file operations. #703

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ StFileBrowserModificationDateColumn class >> addConstraintTo: aTableColumn [
{ #category : 'templateMethod' }
StFileBrowserModificationDateColumn class >> evaluateOn: aFileReference [

^ aFileReference modificationTime fileDialogFormat
^ [ aFileReference modificationTime fileDialogFormat ]
on: Error
do: [ 'N/A' ]
]

{ #category : 'sorting' }
Expand Down
4 changes: 3 additions & 1 deletion src/NewTools-FileBrowser/StFileBrowserRightsColumn.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ StFileBrowserRightsColumn class >> addConstraintTo: aTableColumn [
StFileBrowserRightsColumn class >> evaluateOn: aFileReference [
"I'm provide action for fileReference"

^ aFileReference permissions
^ [ aFileReference permissions ]
on: Error
do: [ 'N/A' ]
]

{ #category : 'sorting' }
Expand Down
8 changes: 6 additions & 2 deletions src/NewTools-FileBrowser/StFileBrowserSizeColumn.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ StFileBrowserSizeColumn class >> addConstraintTo: aTableColumn [

{ #category : 'templateMethod' }
StFileBrowserSizeColumn class >> evaluateOn: aFileReference [

^ aFileReference isDirectory
ifTrue: [ '--' ]
ifFalse: [ aFileReference humanReadableSize ]
ifTrue: [ '--' ]
ifFalse: [
[ aFileReference humanReadableSize ]
on: Error
do: [ 'N/A' ] ]
]

{ #category : 'sorting' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ StFileNavigationSystemPresenter >> connectPresenters [
self configButtonAction.
]

{ #category : 'utilities' }
StFileNavigationSystemPresenter >> currentDirectoryChildren [

^ [ self currentDirectory children select: #exists ]
on: Error
do: [ #( ) ]
]

{ #category : 'initialization' }
StFileNavigationSystemPresenter >> defaultFileSortBlock [

Expand Down Expand Up @@ -425,7 +433,7 @@ StFileNavigationSystemPresenter >> updateFileReferenceTable [
"Update the receiver's contents according to the current directory and apply configured filters"

| items |
items := (filtersDropList selectedItem ifNil: [ filter ]) applyOn: (self currentDirectory children select: #exists).
items := (filtersDropList selectedItem ifNil: [ filter ]) applyOn: self currentDirectoryChildren.
StFileBrowserSettings showHiddenFiles ifFalse: [ items := items reject: [ :file | file isHidden ] ].
fileReferenceTable items: items
]
Expand Down
Loading