Mantis - Squeak
Viewing Issue Advanced Details
1550 System minor always 07-26-05 18:47 07-26-05 18:49
KenCausey  
 
normal  
new  
open  
none    
none  
0001550: [FIX] FileDirectory-checkName-refactoring-jf
julian@beta4.com:

"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."!"
 FileDirectory-checkName-refactoring-jf.cs.gz [^] (1,265 bytes) 07-26-05 18:48

Notes
(0001959)
KenCausey   
07-26-05 18:49   
cg@cdegroot.com:

"I think this is a refactoring that needs to have some unit tests before
we can harvest it."