The Trunk: Files-mt.147.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-mt.147.mcz

commits-2
Marcel Taeumel uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-mt.147.mcz

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

Name: Files-mt.147
Author: mt
Time: 22 October 2015, 10:51:13.247 am
UUID: 088e1934-a399-40ed-923c-a0cdca15894b
Ancestors: Files-topa.146

Adds support for dropping directories into the image.

=============== Diff against Files-topa.146 ===============

Item was added:
+ ----- Method: FileDirectory class>>fileReaderServicesForFile:suffix: (in category 'file reader services') -----
+ fileReaderServicesForFile: fullName suffix: suffix
+
+ ^ (self on: fullName) exists
+ ifTrue: [self services]
+ ifFalse: [#()].!

Item was added:
+ ----- Method: FileDirectory class>>initialize (in category 'class initialization') -----
+ initialize
+
+ FileServices registerFileReader: self.!

Item was added:
+ ----- Method: FileDirectory class>>requestDropDirectory: (in category 'dnd requests') -----
+ requestDropDirectory: dropIndex
+
+ ^ self on: (FileStream primDropRequestFileName: dropIndex)!

Item was added:
+ ----- Method: FileDirectory class>>services (in category 'file reader services') -----
+ services
+
+ ^ (self class selectors copyWithout: #services)
+ select: [:symbol | symbol beginsWith: #service]
+ thenCollect: [:selector | self perform: selector]!

Item was added:
+ ----- Method: FileDirectory>>mimeTypes (in category 'path access') -----
+ mimeTypes
+
+ ^ #('text/directory')!

Item was added:
+ ----- Method: FileDirectory>>name (in category 'path access') -----
+ name
+ "Compatibility with StandardFileStream >> #name to be used, for example, for drop event handling."
+
+ ^ self fullName!

Item was changed:
  ----- Method: FileStream class>>fileReaderServicesForFile:suffix: (in category 'file reader services') -----
  fileReaderServicesForFile: fullName suffix: suffix
  "Answer services for the given file"
 
+ "Check whether the given path points to a directory or file."
+ (FileStream isAFileNamed: fullName) ifFalse: [^ #()].
+
  ^ self servicesWithSuffixes
  select: [:spec | spec key anySatisfy: [:pattern | suffix = '*' or: [pattern match: suffix]]]
  thenCollect: [:spec | spec value]!

Item was added:
+ ----- Method: FileStream class>>primDropRequestFileName: (in category 'dnd requests') -----
+ primDropRequestFileName: dropIndex
+ "Primitive. Return the file name for some file that was just dropped onto Squeak.
+ Fail if dropIndex is out of range or the primitive is not supported."
+ <primitive: 'primitiveDropRequestFileName' module:'DropPlugin'>
+ ^nil!

Item was removed:
- ----- Method: StandardFileStream>>primDropRequestFileName: (in category 'dnd requests') -----
- primDropRequestFileName: dropIndex
- "Primitive. Return the file name for some file that was just dropped onto Squeak.
- Fail if dropIndex is out of range or the primitive is not supported."
- <primitive: 'primitiveDropRequestFileName' module:'DropPlugin'>
- ^nil!

Item was changed:
  ----- Method: StandardFileStream>>requestDropStream: (in category 'dnd requests') -----
  requestDropStream: dropIndex
  "Return a read-only stream for some file the user has just dropped onto Squeak."
  | rawName |
+ rawName := self class primDropRequestFileName: dropIndex.
- rawName := self primDropRequestFileName: dropIndex.
  name :=  (FilePath pathName: rawName isEncoded: true) asSqueakPathName.
  fileID := self primDropRequestFileHandle: dropIndex.
  fileID == nil ifTrue:[^nil].
  self register.
  rwmode := false.
  buffer1 := String new: 1.
  self enableReadBuffering
  !