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

Jay jayk123 at hotmail.com
Thu Jan 10 12:24:20 CET 2008


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.
 
 
?
 
 
C:\dev2\cm3.2\m3-libs\libm3>cvs diffIndex: src/os/WIN32/PathnameWin32.m3===================================================================RCS file: /usr/cvs/cm3/m3-libs/libm3/src/os/WIN32/PathnameWin32.m3,vretrieving revision 1.3diff -r1.3 PathnameWin32.m313c13<   DirSepChar = '\\'; DirSepText = "\\";--->   DirSepText = "\\";17c17< CONST Legal = SET OF CHAR {'\001' .. '\177'} - SET OF CHAR {DirSepChar, ':'};---> CONST Legal = SET OF CHAR {'\001' .. '\177'} - SET OF CHAR {'\\', '/', ':', '?', '*'};21a22,26> PROCEDURE IsDirSepChar(ch: CHAR): BOOLEAN =>   BEGIN>     RETURN (ch = '\\' OR ch = '/');>   END IsDirSepChar;>53,54c58,59<           IF Text.GetChar(t, 0) = DirSepChar AND<              Text.GetChar(t, nRoot - 1) # DirSepChar THEN--->           IF IsDirSepChar(Text.GetChar(t, 0)) AND>              NOT IsDirSepChar(Text.GetChar(t, nRoot - 1)) THEN125c130<             IF c # DirSepChar AND c # DriveSepChar THEN--->             IF NOT IsDirSepChar(c) AND c # DriveSepChar THEN173,174c178,179<         IF c = DirSepChar THEN<           IF n = 1 OR Text.GetChar(t, 1) # DirSepChar THEN RETURN 1 END;--->         IF IsDirSepChar(c) THEN>           IF n = 1 OR NOT IsDirSepChar(Text.GetChar(t, 1)) THEN RETURN 1 END;178c183<                 IF cc = DirSepChar THEN--->                 IF IsDirSepChar(cc) THEN196c201<           IF n > 2 AND Text.GetChar(t, 2) = DirSepChar THEN RETURN 3 END;--->           IF n > 2 AND IsDirSepChar(Text.GetChar(t, 2)) THEN RETURN 3 END;218c223<           IF c = DirSepChar THEN--->           IF IsDirSepChar(c) THEN253c258<         IF ch = DirSepChar OR ch = DriveSepChar THEN--->         IF IsDirSepChar(ch) OR ch = DriveSepChar THEN
 - Jay
_________________________________________________________________
Put your friends on the big screen with Windows Vista® + Windows Live™.
http://www.microsoft.com/windows/shop/specialoffers.mspx?ocid=TXT_TAGLM_CPC_MediaCtr_bigscreen_012008
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20080110/d432b58b/attachment-0002.html>


More information about the M3devel mailing list