Cincom VisualWorks has this code to read the names of the files in a directory:
(Filename named: '.') directoryContents "returns an array of string"
What is the equivalent in Squeak?
--dae
On Dec 23, 2007, at 7:51 , Doug Edmunds wrote:
Cincom VisualWorks has this code to read the names of the files in a directory:
(Filename named: '.') directoryContents "returns an array of string"
What is the equivalent in Squeak?
(FileDirectory on: '.') fileAndDirectoryNames
(also #fileNames, #directoryNames, #entries, etc)
- Bert -
Bert Freudenberg wrote:
On Dec 23, 2007, at 7:51 , Doug Edmunds wrote:
Cincom VisualWorks has this code to read the names of the files in a directory:
(Filename named: '.') directoryContents "returns an array of string"
What is the equivalent in Squeak?
(FileDirectory on: '.') fileAndDirectoryNames
Didn't work. I get a walkback "Error: Fully qualified path expected"
I am using Windows XP, and bumped into this:
DosFileDirectory>>>setPathName: pathString "Ensure pathString is absolute - relative directories aren't supported on all platforms."
(pathString isEmpty or: [pathString first = $\ or: [pathString size >= 2 and: [pathString second = $: and: [pathString first isLetter]]]]) ifTrue: [^ super setPathName: pathString].
self error: 'Fully qualified path expected'
------- dae
On Dec 23, 2007, at 19:02 , Doug Edmunds wrote:
Bert Freudenberg wrote:
On Dec 23, 2007, at 7:51 , Doug Edmunds wrote:
Cincom VisualWorks has this code to read the names of the files in a directory:
(Filename named: '.') directoryContents "returns an array of string"
What is the equivalent in Squeak?
(FileDirectory on: '.') fileAndDirectoryNames
Didn't work. I get a walkback "Error: Fully qualified path expected"
Well, '.' was just a place holder. You need to give a full path.
Squeak does not have a notion of a "current working directory". Try this instead:
FileDirectory default fileAndDirectoryNames
... which usually refers to the directory the image is in.
- Bert -
beginners@lists.squeakfoundation.org