[BUG][FIX] String asURL fails

Stephen Pair spair at advantive.com
Thu Mar 7 14:58:31 UTC 2002


Resent with the Fix header...

> -----Original Message-----
> From: Stephen Pair [mailto:spair at advantive.com] 
> Sent: Thursday, March 07, 2002 9:58 AM
> To: 'squeak-dev at lists.squeakfoundation.org'
> Subject: RE: [BUG] String asURL fails
> 
> 
> > I can't test on a Mac, but this changeset should at least be
> > very close.  You'll have to change the #asUrl to this new 
> > selector, but hopefully that's okay.
> 
> I think this needs to go a step further.  The construct:
> 
> 	FileUrl fromFileName: 'Macintosh HD:Fun with 3.2:Squeak.15.gif'
> 
> should work no matter what platform you are on, or 
> alternatively you should be able to to be explicit about the 
> platform (with the previous example parsing based on the 
> current platform)...for example:
> 
> 	FileUrl fromMacFileName: 'Macintosh HD:Fun with 
> 3.2:Squeak.15.gif'
> 
> There might be situations where you have to deal with a 
> filename formatted for an OS that you don't happen to be 
> using at the moment.  I would propose the following methods:
> 
> 	fromFileName: - uses the delimiter for the current plaform
> 	fromFileName:usingDirectoryClass: - uses the specified 
> FileDirectory class to parse the path 
> 	fromMacFileName: - uses $: for the delimiter
> 	fromDosFileName: - uses $\ for the delimiter
> 	fromUnixFileName: - uses $/ for the delimiter
> 	...etc...
> 
> Unfortunately, there are many methods that assume you want 
> the local file name convention and directly use 
> "FileDirectory pathNameDelimiter" or FileDirectory 
> activeDirectoryClass.  Also, shouldn't "MacFileDirectory on: 
> 'Macintosh HD:Fun with 3.2:Squeak.15.gif'" give me an 
> instance of a MacFileDirectory?  It currently doesn't work 
> unless you happen to be running on the mac plaform.
> 
> The attached change set implements these methods, and adds 
> "FileDirectory class>>basicOn:", which gives you an instance 
> of the receiver (not (necessarily) an instance "FileDirectory 
> activeDirectoryClass").  FileDirectory class>>on: is 
> refactored to use #basicOn:.  So, no matter which platform 
> you are running on, you have the ability take a path name for 
> any platform and convert it to a Url.
> 
> - Stephen
> 




More information about the Squeak-dev mailing list