[ANN] FileMan on SqueakMap
Masashi UMEZAWA
masashi.umezawa at gmail.com
Thu Oct 5 12:57:35 UTC 2006
Hi,
I've released FileMan on SqueakMap.
http://map.squeak.org/package/f9917683-25da-4a6c-a013-b36527a100c1
Squeak's file libraries (Directory, DirectoryEntry, FileStream, etc.)
are sometimes very confusing to use. FileMan provides a simple,
refactored interfaces for manipulating files and directories by
wrapping those classes.
"Before"
subDir := FileDirectory default directoryNamed: 'subDir'.
subDir assureExistence.
[str := subDir newFileNamed: 'file1'.
str nextPutAll: 'Hello!']
ensure: [str close].
"After installation of FileMan"
'./subDir' asDirectoryEntry at: 'file2' put: 'Hello!'.
Another example:
"Copy all contents in ./doc to ./bkup/yymmdd (for daily backup)"
'./doc' asDirectoryEntry copyTo: './bkup' / Date today yyyymmdd.
Features:
- Path representation is portable (the example code runs on Windows,
Mac, Linux).
- Small package (consists of just two classes - FmDirectoryEntry, FmFileEntry)
- Basic file operations
- Dictionary-like operations
- Pipe-like operations
- Zip archive operations
Enjoy!
--
[:masashi | ^umezawa]
More information about the Squeak-dev
mailing list
|