[M3devel] win32 path separators -- support forward and backward in libm3?

Olaf Wagner wagner at elegosoft.com
Thu Jan 10 13:58:50 CET 2008


Quoting Jay <jayk123 at hotmail.com>:

> To a very large extent, Win32 accepts both / and \ equally as path   
> delimiters.
> CreateFile, DeleteFile, CreateDirectory, MoveFile, CopyFile,   
> FindFirstFile, GetFileAttributes, the C runtime wrappers fopen,   
> unlink/remove, stat, etc., those all work either way, or with a mix.
> "Shell" functions like shlwapi.dll, commdlg32.dll, tend not to.
>
> In building NT386GNU, I run into places where cm3 is picking apart paths.
> For whatever reason, it is being given paths with a mix of forward   
> and backward slashes.
> I find these paths ugly, but they work ok.
>
> I've been able to easily progress by changing   
> m3-libs/libm3/src/os/WIN32/PathnameWin32.m3 to treat forward and   
> backslashes the same.
> I have not yet rebuilt the normal NT386 target with this change.
>
> An ok change?
>
> Or go and fix NT386GNU a) to be consistent, b) use backward slashes,  
>  c) translate at some place.
>
> ?

In my opininion NT386GNU should be a POSIX target and thus use forward
slashes as standard as POSIX defines. Offhand I wouldn't object to accept
backward slashes as path delimiters, too. But you must heed that \
is used as an escape character almost everywhere (and so should it be
in pathname denotations then: a\\b\\c) or you loose much compatibility.

I still wonder if the decision to use \ on DOS/Windows was only made to
be as incompatible as possible with Unix...

Olaf
-- 
Olaf Wagner -- elego Software Solutions GmbH
                Gustav-Meyer-Allee 25 / Gebäude 12, 13355 Berlin, Germany
phone: +49 30 23 45 86 96  mobile: +49 177 2345 869  fax: +49 30 23 45 86 95
    http://www.elegosoft.com | Geschäftsführer: Olaf Wagner | Sitz: Berlin
Handelregister: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194




More information about the M3devel mailing list