[FIX] FileDirectory-checkName-refactoring-jf

julian at beta4.com julian at beta4.com
Tue Feb 10 01:40:53 UTC 2004


The unixfiledirectory does not consider / to be a problem when naming a file
 which, of course, it should.  this changeset refactors the #checkname:
 fixErrors: methods to make it easier to add this functionality to
 UnixFileDirectory and then does so.

Note that I think these methods should be moved to the class side since
they do not depend in any way on having an instance to work with.  But
that seemed like something that might raise more controversy.  I wanted
to get this fix included first and if there is interest, I will look at
moving them to the class side next.  This would mean having a
basicCheckName:fixErrors: or something so that #checkName:fixErrors: on
FileDirectory can dispatch to the correct file directory class and the
basic version can do the default handling itself.

from preamble:

"Change Set:		FileDirectory-checkName-refactoring-jf
Date:			7 February 2004
Author:			Julian Fitzell

The file name validation on the FileDirectory was poorly factored -
there were two nearly identical methods on AcornFileDirectory and
DosFileDirectory and the Unix and Mac variants weren't doing any
character validation.  This changeset moves the functionality of
#checkName:fixErrors: on the two subclasses up into the version on
FileDirectory and makes calls to get a list of invalid characters and a
valid character to replace them with.  Each of the subclasses can define
these methods, #illegalFileNameCharacters and
#replacementLegalFileNameCharacter.

There should be no change of behaviour in any of the directory classes
except for UnixFileDirectory which now defines / as an illegal
character.  I don't know if there are other characters that are illegal
on Unix--all the other characters defined as illegal on the Dos and
Acorn classes seem fine--and I haven't defined the illegal character set
for the MacFileDirectory.  Someone who knows could fill this out a
little."!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FileDirectory-checkName-refactoring-jf.cs.gz
Type: application/octet-stream
Size: 1265 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040209/8148664e/FileDirectory-checkName-refactoring-jf.cs.obj


More information about the Squeak-dev mailing list