Should FileDirectory paths have a dirsep on the end or not?

Mark Guzdial guzdial at cc.gatech.edu
Mon May 4 13:30:35 UTC 1998


At 6:37 PM -0700 5/3/98, Tim Rowledge wrote:
>On Sun 03 May, Maloney wrote:
>> P.S. Do you have a pointer to the problem methods in PWS?
>It was SwikiAction class>setUp: that caused the problem. There is a line
>'dir _ FileDirectory on: (ServerAction serverDirectory).
> (dir directoryNames includes: actionName)......'
>and if I put a dirsep at the end of the server dirname, the directoryNames
>is empty, so obviously the system decides I don't have a suitable directory
>with which to work.

It's actually more common than just in setUp.  Consider the
ServerAction>>fileContents method, which is used for serving all files:
     fileContents: serverFileRef
	^(FileStream fileNamed: (ServerAction serverDirectory) , serverFileRef)
	 contentsOfEntireFile

Again, there's the assumption the serverDirectory ends in the path
separator, and it's just concatenated on to the serverFile reference in
order to grab the file.  Just about every file reference is going to make
this assumption, I fear.

>Wouldn't
>it be better to create and use the FileDirectory object anyway, rather than
>repetitively building strings into paths without a decent protocol to
>handle pathname rules?

You're almost certainly correct.  It's a case of knowing the right way vs.
knowing a way.  I'm still relatively novice and am only just recently
started figuring out how to use FileDirectory objects, and I'd never heard
of them six months ago.  But I did know how to concatenate strings! :-)

In general, it's a hard problem -- you don't want to have someone spend
ages learning everything in the image before he or she can start work in
Smalltalk (or any large system), but how do you make sure that standard
ways of doing things occur everywhere?

Also, Tim, be sure to check out the updates page at
http://www.cc.gatech.edu/fac/mark.guzdial/squeak/pws/131updates.html A
variety of bugs and enhancements have been made to PWS and Swiki's since
the 1.31 release.

Mark

--------------------------
Mark Guzdial : Georgia Tech : College of Computing : Atlanta, GA 30332-0280
(404) 894-5618 : Fax (404) 894-0673 : guzdial at cc.gatech.edu
http://www.cc.gatech.edu/gvu/people/Faculty/Mark.Guzdial.html





More information about the Squeak-dev mailing list