[FIX] FileNameFrmItemFix.08Sep0333

Robert Hirschfeld hirschfeld at acm.org
Sat Sep 8 01:46:27 UTC 2001


"Change Set:		FileNameFrmItemFix
Date:			8 September 2001
Author:			Robert Hirschfeld

Fixes a problem with FileList>>fileNameFromFormattedItem: that does not 
work when files in a file list (2?) are sorted by name. To reproduce 
the problem: open a MPEGPlayer, press open, select a directory 
containing mpeg files, change the sort order in the right pane to 
sort-by-name, select a file and press OK..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FileNameFrmItemFix.08Sep0333.cs.gz
Type: application/x-gzip
Size: 575 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20010907/8376f30b/FileNameFrmItemFix.08Sep0333.cs.bin
-------------- next part --------------
'From Squeak3.1alpha of 7 March 2001 [latest update: #4325] on 8 September 2001 at 3:33:33 am'!
"Change Set:		FileNameFrmItemFix
Date:			8 September 2001
Author:			Robert Hirschfeld

Fixes a problem with FileList>>fileNameFromFormattedItem: that does not work when files in a file list (2?) are sorted by name. To reproduce the problem: open a MPEGPlayer, press open, select a directory containing mpeg files, change the sort order in the right pane to sort-by-name, select a file and press OK..."!


!FileList methodsFor: 'private' stamp: 'rhi 9/8/2001 02:17'!
fileNameFromFormattedItem: item
	"Extract fileName and folderString from a formatted fileList item string"

	| from to |
	self sortingByName
		ifTrue: [
			from _ item lastIndexOf: $( ifAbsent: [0].
			to _ item lastIndexOf: $) ifAbsent: [0]]
		ifFalse: [
			from _ item indexOf: $( ifAbsent: [0].
			to _ item indexOf: $) ifAbsent: [0]].
	^ (from * to = 0
		ifTrue: [item]
		ifFalse: [item copyReplaceFrom: from to: to with: '']) withBlanksTrimmed! !



More information about the Squeak-dev mailing list