[squeak-dev] Altitude - a simple directory list app

H. Hirzel hannes.hirzel at gmail.com
Tue Sep 4 02:47:36 UTC 2012


Thank you Chris for this example.

It is illustrative for me.

Only two classes

  ALDirectoryListApplication   (subclass of ALApplication, 1 method)
  ALDirectoryListPage   (4 methods)
  plus a method in ALDigestLocator

Remark: I would not hard code the directory listed ('package-cache')
into the #renderBodyOn: method


renderBodyOn: html
	| docroot scanner |
	docroot := FSLocator imageDirectory / 'package-cache'.
	scanner := ALDirectoryScanner scan: docroot into: locator.
	scanner resources keys do: [: ea | html a href: ea asString; with: ea
asString. html br  ]


but instead set it in

ALDirectoryListApplication>>initializeLocator
	locator
		at: ALPath root
		put: (ALHtmlResource component: (ALDirectoryListPage new locator: locator))


something like:

ALDirectoryListApplication>>initializeLocator
	locator
		at: ALPath root
		put: (ALHtmlResource component:
                                     (ALDirectoryListPage locator: locator
                                       docroot: FSLocator
imageDirectory / 'package-cache'.))


BTW what is an ALDigestLocator?

At the moment  cannot comment on more substantial things as I have to
start reading the few notes (Colin, Frank Sch.) and do more browsing
of the code...

Regards
Hannes


P.S. I thought there is a counter example around somewhere as well. It
is not in Colin's code. Where do I find it?


On 9/3/12, Chris Cunnington <smalltalktelevision at gmail.com> wrote:
> I've taken a crack at creating an app that lists the contents of a
> directory as links. Hit a link and it downloads the file in the
> package-cache. Does ALDigestLocator want a #resources getter? Is this
> bad design? I have no idea.
>
> Chris
>
> It's available here:
>
> http://ss3.gemstone.com/ss/Oakville/
>
>
> server := ALServer on: 8624 application: ALDirectoryListApplication new.
> server start.
>
> server isRunning
>
> server stop
>
>


More information about the Squeak-dev mailing list