Hee,
I've fixed two bugs in the VFSAddOns package, both in fileData, which
should make the package usable now.
The first bug was a little hard to find as it seemed to be time related.
It showed up every now and then. It seemed to be the case that a pipe
was still being read out while it's output was already being processed.
The second bug. fileData returns an array with some information, but the
VFSAddOns package didn't fill every variable in this array. A loop goes
over a string and extracts information from it. The Date package read
the string till the end while processing the date, leaving no data for
any processing after it.
I've attached a patch, which should explain some more.
diff --git a/packages/vfs/VFS.st b/packages/vfs/VFS.st
index cf02bd2..e926ea8 100644
--- a/packages/vfs/VFS.st
+++ b/packages/vfs/VFS.st
@@ -183,9 +183,17 @@ Commander and with GNOME VFS.'>
<category: 'ArchiveMember protocol'>
^Generator on:
[:gen |
- | pipe |
+ | pipe temp |
pipe := FileStream popen: command , ' list ' , self file name
dir: FileStream read.
+
+ "pipe linesDo failed because FileStream popen.... seemed to be still processing stuff
+ while pipe Linesdo: was already executed. Now first read the entire contents of pipe to temp and
+ then process temp"
+
+ temp := pipe contents.
+ pipe := ReadWriteStream on: temp.
+
pipe linesDo:
[:l |
| line mode size path date |
@@ -200,14 +208,22 @@ Commander and with GNOME VFS.'>
line skipSeparators].
size := Number readFrom: line. "File size"
line skipSeparators.
- date := DateTime readFrom: line. "Date"
- line skipSeparators.
- path := line upToAll: ' -> '. "Path"
- gen yield:
- {path.
- size.
- date.
- mode}].
+ date := ''.
+ path := ''.
+ [line atEnd] whileFalse: [
+ path := path, (line peek) asString.
+ (line peek = Character space) ifTrue: [path := ''].
+ date := date, line next asString.
+ ].
+
+ date := ReadStream on: date.
+ date := DateTime readFrom: date.
+
+ gen yield:
+ {path.
+ size.
+ date.
+ mode}].
pipe close]
]
]
_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk