[Cuis-dev] macOS directory and file names containing colons

Juan Vuletich juan at cuis.st
Mon Mar 4 10:26:25 PST 2024

Hi Bernhard,

Interesting issue. $: as a directory separator was only used for Classic 
Mac OS, that ran only on Motorola 68k and PowerPC. According to 
Wikipedia, its support status is "Historical, unsupported as of February 
1, 2002", That's 22 years ago. I think it is safe to abandon support for 
$: as a directory separator.

Just pushed an update for this.


On 3/3/2024 6:47 PM, Bernhard Pieber via Cuis-dev wrote:
> Hi,
> In macOS Finder it is possible to create directories and file names 
> which contain forward slashes. I created a directory named a/b with a 
> file named b/c. Under the hood the slash is converted to a colon, e.g.
> bernhard at MacBookPro16 Cuis-Smalltalk-Dev % find . -name b:c
> ./a:b/b:c
> See also 
> https://stackoverflow.com/questions/13298434/colon-appears-as-forward-slash-when-creating-file-name
> In Cuis the names are shown with colons as well. The following 
> expression answers true:
> (DirectoryEntry vmDirectory directoryMatching: 'a:b') exists. „true“
> However, the following expression answers false:
> (DirectoryEntry vmDirectory / 'a:b') exists.
> The reason for this is that on macOS the colon is not a separator – it 
> was in Classic Mac OS, while Cuis assumes it still is, see String 
> class>>#pathSeparators:
> pathSeparators
> ^'\:/'
> Seeing this implementation made me realize the same problem exists for 
> directory and file names including a backslash. While I can create 
> them in Finder, Cuis does not fully support them.
> Creating such directories fails as well:
> DirectoryEntry vmDirectory assureExistenceDirNamed: 'bin:go'.
> DirectoryEntry vmDirectory assureExistenceDirNamed: 'bin\go‘.
> Interestingly, using SqueakCompatibility the following works:
> (FileDirectory on: 
> '/Users/bernhard/Entwicklung/Cuis/Cuis-Smalltalk/Cuis-Smalltalk-Dev') 
> createDirectory: 'bin:go'.
> (FileDirectory on: 
> '/Users/bernhard/Entwicklung/Cuis/Cuis-Smalltalk/Cuis-Smalltalk-Dev') 
> createDirectory: 'bin\go‘.
> The best fix would probably be to make the path separator platform 
> dependent. (However, given that Smalltalk platformName returns 'Mac 
> OS' even on macOS, I am not sure how best to distinguish between 
> Classic Mac OS and macOS.)
> Cheers,
> Bernhard
Juan Vuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240304/b979a46e/attachment.htm>

More information about the Cuis-dev mailing list