The Trunk: Files-eem.187.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Files-eem.187.mcz

commits-2
Eliot Miranda uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-eem.187.mcz

==================== Summary ====================

Name: Files-eem.187
Author: eem
Time: 4 March 2021, 10:21:30.924262 am
UUID: f14c3a5e-9f1b-4aff-9c3d-b239a4c9a5e9
Ancestors: Files-ul.186

Robustness with drop events.
Put colleting directories and streams in a utility method for headless apps (drop events can be launch events on OSs such as macOS).
Fix a speeling roore.

=============== Diff against Files-ul.186 ===============

Item was added:
+ ----- Method: FileDirectory class>>dropFilesAndDirectories: (in category 'dnd requests') -----
+ dropFilesAndDirectories: numFiles
+ "Answer a sequence of directories and/or streams for a drop event.
+ The collect5ion may be empty."
+ ^(1 to: numFiles)
+ collect:
+ [:index |
+ (self requestDropDirectory: index) ifNil:
+ [FileStream requestDropStream: index]]
+ thenSelect: [:directoryOrStreamOrNil| directoryOrStreamOrNil notNil]!

Item was changed:
  ----- Method: FileDirectory class>>requestDropDirectory: (in category 'dnd requests') -----
  requestDropDirectory: dropIndex
 
  ^(FileStream primDropRequestFileName: dropIndex) ifNotNil:
+ [:dropFileName| | potentialDirectory |
+ potentialDirectory := self on: dropFileName.
- [:dropFileDirdectoryName| | potentialDirectory |
- potentialDirectory := self on: dropFileDirdectoryName.
  potentialDirectory exists ifTrue: [potentialDirectory]]!

Item was changed:
  ----- Method: StandardFileStream>>requestDropStream: (in category 'dnd requests') -----
  requestDropStream: dropIndex
+ "Answer a read-only stream for some file the user has just dropped onto Squeak,
+ or nil if dropIndex does not refer to a file."
+ ^(self class primDropRequestFileName: dropIndex) ifNotNil:
+ [:rawName|
+ name := rawName vmPathToSqueakPath.
+ fileID := self primDropRequestFileHandle: dropIndex.
+ fileID ifNotNil:
+ [self register.
+ rwmode := false.
+ buffer1 := String new: 1.
+ self enableReadBuffering.
+ self]]!
- "Return a read-only stream for some file the user has just dropped onto Squeak."
- | rawName |
- rawName := self class primDropRequestFileName: dropIndex.
- name := rawName vmPathToSqueakPath.
- fileID := self primDropRequestFileHandle: dropIndex.
- fileID == nil ifTrue:[^nil].
- self register.
- rwmode := false.
- buffer1 := String new: 1.
- self enableReadBuffering
- !