Filename>>chop:to: changes file name

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Filename>>chop:to: changes file name

Terry Raymond

I was testing to see how illegal filenames were handled and found

that #chop:to: removes illegal characters when forming a file name.

 

This is a bad idea. It has the potential to inadvertently change the wrong

file and nobody would have any idea how it happened.

 

It should raise an exception.

 

On windows;

‘>test.txt’ asFilename asString

will produce   ‘test.txt’

no exception is raised.

 

Additionally, on windows 7, using a * or ? in a file name will produce

an exception when the system attempts to create a file.

 

| strm |

strm := ‘?test.txt’ asFilename writeStream.

strm nextPutAll: ‘stuff’;cr.

strm close.

 

If you change the ? to a > then the file test.txt will be created.

 

Terry

 

===========================================================

Terry Raymond

Crafted Smalltalk

80 Lazywood Ln.

Tiverton, RI  02878

(401) 624-4517      [hidden email]

===========================================================

 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc