I need your help.
If you have any non-Macintosh (non-HFS) formatted disks that
you can mount on your Mac (e.g.: UFS, DOS, FAT, FAT32, UDF) or
non-AppleShare network volumes (DAVE, PCMACLAN, Helios,
Novell, NFS, etc.), would you please run this code and tell
me if it reports a mismatch? (If it succeeds OK, everything is
fine and you could still report to me which of the non-Mac file
formats you had tested it with.)
If you have only standard Mac disks (HFS, HFS+, or network volumes
server from another Macintosh), then you do not need to run
this test for me, because the outcome is already well known.
To test it for me, make sure you have your special volumes mounted
or inserted, then run the code below - it will check all volumes
in no more than a few seconds and should report either success
or failure.
The test it performs is to compare the actual number of items
in a folder with the number that FolderItem.Count returns.
I know that some file systems do return an incorrect value
here, making this test code report a mismatch, but I need proof
from others to be able to make my point about how to safely
delete folders.
Here's the test code, it's a subroutine "countItems" plus
the main code that you could paste into a new prj's "Open"
event of Window1:
Function countItems(d as FolderItem) As Integer
dim n as Integer
n = 1
do
if d.TrueItem(n) = nil then
return n-1
end
n = n + 1
loop
End Function
Sub Open()
dim d, f, vol as FolderItem
dim volIdx, dirIdx, n1, n2 as Integer
for volIdx = 1 to 99
vol = Volume(volIdx)
if vol = nil then
MsgBox "Everything OK. Thanks for testing."
quit
end
n1 = vol.Count
n2 = countItems(vol)
if n1 <> n2 then
MsgBox "Count mismatch on Volume "+vol.Name+"!"+chr(13)+"Please
report to rb at tempel dot org what kind of disk this is (Network, CD, ...?)"
quit
end
for dirIdx = 1 to vol.Count
d = vol.TrueItem(dirIdx)
if d <> nil and d.Directory then
n1 = vol.Count
n2 = countItems(vol)
if n1 <> n2 then
MsgBox "Count mismatch in dir "+d.Name+" on Volume
"+vol.Name+"!"+chr(13)+"Please report to rb at tempel dot org what kind of disk
this is (Network, CD, ...?)"
quit
end
if n1 > 1 then
exit // 'nuff tested on this vol
end
end
next
next
End Sub
--
Thomas Tempelmann,
http://www.tempel.org/rb/
http://www.tempel.org/software/
---
A searchable archive of this list is available at:
<http://support.realsoftware.com/listarchives/search.php>
Unsubscribe:
<mailto:realbasic-nug-off at lists dot realsoftware dot com>
Subscribe to the digest:
<mailto:realbasic-nug-digest at lists dot realsoftware dot com>
.
|