|
|
Class: AutoDeletedFilename
Object
|
+--Filename
|
+--AutoDeletedFilename
- Package:
- stx:libbasic
- Category:
- System-Support
- Version:
- rev:
1.7
date: 2009/06/22 21:57:00
- user: stefan
- file: AutoDeletedFilename.st directory: libbasic
- module: stx stc-classLibrary: libbasic
Used with temporary files - these will automatically delete themself,
when no longer referenced.
See -> Filename asAutoDeletedFilename
queries
-
isAbstract
-
accessing
-
finalize
-
Transcript showCR:'AutoDeletedFilename: deleting ', self pathName.
-
setName: aString
-
removing
-
recursiveRemove
-
-
remove
-
-
removeDirectory
-
-
removeFile
-
the following file will be automatically deleted after some time:
|f p|
f := Filename newTemporary.
f writeStream
nextPutLine:'hello';
close.
p := f pathName.
Transcript showCR:p.
f := f asAutoDeletedFilename.
self assert:(p asFilename exists).
ObjectMemory collectGarbage.
Delay waitForSeconds:2.
self assert:(p asFilename exists).
f := nil.
ObjectMemory collectGarbage.
Delay waitForSeconds:2.
self assert:(p asFilename exists not).
|
you can also delete it manually:
|f p|
f := Filename newTemporary.
f writeStream
nextPutLine:'hello';
close.
p := f pathName.
Transcript showCR:p.
f := f asAutoDeletedFilename.
self assert:(p asFilename exists).
ObjectMemory collectGarbage.
Delay waitForSeconds:2.
self assert:(p asFilename exists).
f remove.
f := nil.
ObjectMemory collectGarbage.
Delay waitForSeconds:2.
self assert:(p asFilename exists not).
|
|