help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Directory enumeration


From: Stephen
Subject: [Help-smalltalk] Directory enumeration
Date: Sat, 01 Dec 2007 12:28:31 +1300
User-agent: Thunderbird 2.0.0.9 (Macintosh/20071031)

Better give you the version and here is the code I'm using.


Version: Linux
gst -v   -> GNU Smalltalk version 2.3.6


Code sample
------------
#! /usr/local/bin/gst  -f


Object subclass: #DirNav
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'SG-Scripting'!

!DirNav methodsFor: 'operation'!

enum_folders: dirname
   | homedir |
   (File exists: dirname)
      ifTrue:  [
           homedir := Directory name: dirname.
           homedir allFilesMatching: '*' do: [ :file |
           Transcript showCr: file name.
      ]    ]
   ! !

Smalltalk at: #dirnav put: (DirNav new) !
dirnav init !
dirnav enum_folders: '/home/stephenw/projects_smalltalk' !




Thanks
Stephen





reply via email to

[Prev in Thread] Current Thread [Next in Thread]