FileDirectory tests for has-files and has-subdirs.
=============== Diff against Files-nice.175 ===============
Item was changed:
----- Method: AcornFileDirectory class>>parentDirectoryNickname (in category 'platform specific') -----
"Answer the nick-name for the parent directory (e.g. '..' on Unix and Windows).
+ Acorn chose to use the much more sensible ^; after all it points upwards..."
- Who knows what this is on Acorn?"
Item was removed:
- ----- Method: FileDirectory class>>setDefaultDirectoryFrom: (in category 'system start up') -----
- setDefaultDirectoryFrom: imageName
- "Initialize the default directory to the directory containing the Squeak image file. This method is called when the image starts up."
- DirectoryClass := self activeDirectoryClass.
- DefaultDirectory := self on: (FilePath pathName: (self dirPathFor: imageName) isEncoded: true) asSqueakPathName.
Item was added:
+ ----- Method: FileDirectory>>hasFiles (in category 'testing') -----
+ "Return true if we find an entry that is a file, false otherwise"
+ "FileDirectory default hasFiles"
+ self entriesDo: [ :entry |entry isDirectory ifFalse: [^true] ] .
Item was added:
+ ----- Method: FileDirectory>>hasSubDirectories (in category 'testing') -----
+ "Return true if we find an entry that is a directory, false otherwise"
+ "FileDirectory default hasSubDirectories"
+ self entriesDo: [ :entry |entry isDirectory ifTrue: [^true] ] .
+ !UnixFileDirectory commentStamp: 'tpr 12/26/2017 13:44' prior: 0!
- !UnixFileDirectory commentStamp: '<historical>' prior: 0!
I represent a Unix FileDirectory.
+ It is worth noting that the various enumeration methods do *not* include the parent and local directory pseudo-names '.' and '..'. They are filtered out in the primitive that reads the directory entries.