[BUG] FileList does not rename and does not delete some files
David T. Lewis
lewis at mail.msen.com
Tue Jan 6 21:43:08 UTC 2004
On Tue, Jan 06, 2004 at 01:03:45PM -0800, Tim Rowledge wrote:
> Ned Konz <ned at squeakland.org> wrote:
> > Are these files open somehow? Some versions of Windows won't let you delete or
> > rename open files.
> I should hope that NO OS ever would let you delete open files. Renaming
> seems like a pretty bad idea too.
On Unix, cannot "delete" files at all, for pretty much the same reason
that you cannot "delete" objects in Squeak. Once all of the references
to a file go away, it gets garbage collected by the operating system.
This makes it perfectly all right to remove the name of the file from
the directory (using the "rm" command), but doing so does not necessarily
result in the actual file being removed. Deleting a file in Unix is
just like nilling out a variable in a workspace in Squeak.
This actually has some nice attributes (besides just being appealing
by virtue of its Squeakiness). For example, if you use a temporary
file, you do not need to remember to delete it some time after your
program is done using it. Just open the file, "rm" its name from the
directory, and the file will get garbage collected some time in the
future after you close your last reference to it.
p.s. Actually, there is one difference. Once you remove the last remaining
name for your file from a file system, you cannot go back and say:
FileSystemEntry allInstances detect: [:file | file justGotDeletedByBoneheadUserAction]
Squeak is considerably more forgiving it this regard ;-)
More information about the Squeak-dev