--- a/Win32OperatingSystem.st Wed May 15 19:05:35 2013 +0200
+++ b/Win32OperatingSystem.st Wed May 15 19:06:14 2013 +0200
@@ -5528,16 +5528,16 @@
"return some object filled with info for the file 'aPathName';
the info (for which corresponding access methods are understood by
the returned object) is:
- type - a symbol giving the files type
- mode - numeric access mode
- uid - owners user id
- gid - owners group id
- size - files size
- id - files number (i.e. inode number)
- accessed - last access time (as Timestamp)
- modified - last modification time (as Timestamp)
- statusChanged - last status change time (as Timestamp)
- alternativeName - (windows only:) the MSDOS name of the file
+ type - a symbol giving the files type
+ mode - numeric access mode
+ uid - owners user id
+ gid - owners group id
+ size - files size
+ id - files number (i.e. inode number)
+ accessed - last access time (as Timestamp)
+ modified - last modification time (as Timestamp)
+ statusChanged - last status change time (as Timestamp)
+ alternativeName - (windows only:) the MSDOS name of the file
Some of the fields may be returned as nil on systems which do not provide
all of the information.
@@ -5564,45 +5564,45 @@
wchar_t _aPathName[MAXPATHLEN+1];
if (__isStringLike(aPathName)) {
- int i;
- int l = __stringSize(aPathName);
- if (l > MAXPATHLEN) l = MAXPATHLEN;
-
- for (i=0; i<l; i++) {
- _aPathName[i] = __stringVal(aPathName)[i];
- }
- _aPathName[i] = 0;
+ int i;
+ int l = __stringSize(aPathName);
+ if (l > MAXPATHLEN) l = MAXPATHLEN;
+
+ for (i=0; i<l; i++) {
+ _aPathName[i] = __stringVal(aPathName)[i];
+ }
+ _aPathName[i] = 0;
} else if (__isUnicode16String(aPathName)) {
- int i;
- int l = __unicode16StringSize(aPathName);
- if (l > MAXPATHLEN) l = MAXPATHLEN;
-
- for (i=0; i<l; i++) {
- _aPathName[i] = __unicode16StringVal(aPathName)[i];
- }
- _aPathName[i] = 0;
+ int i;
+ int l = __unicode16StringSize(aPathName);
+ if (l > MAXPATHLEN) l = MAXPATHLEN;
+
+ for (i=0; i<l; i++) {
+ _aPathName[i] = __unicode16StringVal(aPathName)[i];
+ }
+ _aPathName[i] = 0;
} else
- goto badArgument;
+ goto badArgument;
#ifdef DO_WRAP_CALLS
{
- do {
- __threadErrno = 0;
- result = STX_API_NOINT_CALL3( "GetFileAttributesExW", GetFileAttributesExW, _aPathName, GetFileExInfoStandard, &fileAttributeData);
- } while (!result && (__threadErrno == EINTR));
+ do {
+ __threadErrno = 0;
+ result = STX_API_NOINT_CALL3( "GetFileAttributesExW", GetFileAttributesExW, _aPathName, GetFileExInfoStandard, &fileAttributeData);
+ } while (!result && (__threadErrno == EINTR));
}
#else
result = GetFileAttributesExW(_aPathName, GetFileExInfoStandard, &fileAttributeData);
if (!result) {
- __threadErrno = __WIN32_ERR(GetLastError());
+ __threadErrno = __WIN32_ERR(GetLastError());
}
#endif
if (!result) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
} else {
- id = __mkSmallInteger(0); /* could get it by opening ... */
- size = __MKLARGEINT64(1, fileAttributeData.nFileSizeLow, fileAttributeData.nFileSizeHigh);
+ id = __mkSmallInteger(0); /* could get it by opening ... */
+ size = __MKLARGEINT64(1, fileAttributeData.nFileSizeLow, fileAttributeData.nFileSizeHigh);
// if (fileAttributeData.cFileName[0] != '\0') {
// bcopy(fileAttributeData.cFileName, fileNameBuffer, MAXPATHLEN*sizeof(wchar_t));
@@ -5616,83 +5616,83 @@
// alternativeName = __MKU16STRING(alternativeFileNameBuffer); /* DOS name */
// }
- /*
- * simulate access bits
- */
- if (fileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
- modeBits = 0444;
- } else {
- modeBits = 0666;
- }
-
- if (fileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
- type = @symbol(directory);
- modeBits = 0777; /* executable and WRITABLE - refer to comment in #isWritable: */
- } else if (fileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
- type = @symbol(symbolicLink);
- modeBits = 0777; /* even in UNIX symlinks have 0777 */
- } else {
- type = @symbol(regular);
- }
-
- mode = __mkSmallInteger(modeBits);
-
- cOsTime = FileTimeToOsTime(&fileAttributeData.ftCreationTime);
- aOsTime = FileTimeToOsTime(&fileAttributeData.ftLastAccessTime);
- mOsTime = FileTimeToOsTime(&fileAttributeData.ftLastWriteTime);
+ /*
+ * simulate access bits
+ */
+ if (fileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
+ modeBits = 0444;
+ } else {
+ modeBits = 0666;
+ }
+
+ if (fileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
+ type = @symbol(directory);
+ modeBits = 0777; /* executable and WRITABLE - refer to comment in #isWritable: */
+ } else if (fileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
+ type = @symbol(symbolicLink);
+ modeBits = 0777; /* even in UNIX symlinks have 0777 */
+ } else {
+ type = @symbol(regular);
+ }
+
+ mode = __mkSmallInteger(modeBits);
+
+ cOsTime = FileTimeToOsTime(&fileAttributeData.ftCreationTime);
+ aOsTime = FileTimeToOsTime(&fileAttributeData.ftLastAccessTime);
+ mOsTime = FileTimeToOsTime(&fileAttributeData.ftLastWriteTime);
}
badArgument: ;
%}.
(aPathName endsWith:'.lnk') ifTrue:[
- type := #symbolicLink.
- "/ now done lazyly in FileStatusInfo, when the path is accessed
- "/ path := self getLinkTarget:aPathName.
+ type := #symbolicLink.
+ "/ now done lazyly in FileStatusInfo, when the path is accessed
+ "/ path := self getLinkTarget:aPathName.
].
mode isNil ifTrue:[
- (self isDirectory:aPathName) ifTrue:[
- "/ the code above fails for root directories (these do not exist).
- "/ simulate here
- mode := 8r777.
- type := #directory.
- uid := gid := 0.
- size := 0.
- id := 0.
- atime := mtime := ctime := Timestamp now.
- ].
+ (self isDirectory:aPathName) ifTrue:[
+ "/ the code above fails for root directories (these do not exist).
+ "/ simulate here
+ mode := 8r777.
+ type := #directory.
+ uid := gid := 0.
+ size := 0.
+ id := 0.
+ atime := mtime := ctime := Timestamp now.
+ ].
].
mode notNil ifTrue:[
- atime isNil ifTrue:[
- atime := Timestamp new fromOSTime:aOsTime.
- ].
- mtime isNil ifTrue:[
- mtime := Timestamp new fromOSTime:mOsTime.
- ].
- ctime isNil ifTrue:[
- ctime := Timestamp new fromOSTime:cOsTime.
- ].
- fileName notNil ifTrue:[
- fileName := fileName asSingleByteStringIfPossible
- ].
- alternativeName notNil ifTrue:[
- alternativeName := alternativeName asSingleByteStringIfPossible
- ].
- info := FileStatusInfo
- type:type
- mode:mode
- uid:uid
- gid:gid
- size:size
- id:id
- accessed:atime
- modified:mtime
- created:ctime
- sourcePath:aPathName
- fullName:fileName
- alternativeName:alternativeName.
- ^ info
+ atime isNil ifTrue:[
+ atime := Timestamp new fromOSTime:aOsTime.
+ ].
+ mtime isNil ifTrue:[
+ mtime := Timestamp new fromOSTime:mOsTime.
+ ].
+ ctime isNil ifTrue:[
+ ctime := Timestamp new fromOSTime:cOsTime.
+ ].
+ fileName notNil ifTrue:[
+ fileName := fileName asSingleByteStringIfPossible
+ ].
+ alternativeName notNil ifTrue:[
+ alternativeName := alternativeName asSingleByteStringIfPossible
+ ].
+ info := FileStatusInfo
+ type:type
+ mode:mode
+ uid:uid
+ gid:gid
+ size:size
+ id:id
+ accessed:atime
+ modified:mtime
+ created:ctime
+ sourcePath:aPathName
+ fullName:fileName
+ alternativeName:alternativeName.
+ ^ info
].
^ nil
@@ -5865,21 +5865,21 @@
%{
if (__isStringLike(aPathName)) {
- char nameBuffer[MAXPATHLEN + 1];
- char nameBuffer2[MAXPATHLEN + 1];
- char *returnedName = NULL;
- int rslt;
+ char nameBuffer[MAXPATHLEN + 1];
+ char nameBuffer2[MAXPATHLEN + 1];
+ char *returnedName = NULL;
+ int rslt;
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN+1];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- rslt = STX_API_NOINT_CALL4( "GetFullPathNameA", GetFullPathNameA, _aPathName, MAXPATHLEN, nameBuffer, NULL);
- } while ((rslt < 0) && (__threadErrno == EINTR));
-#else
- rslt = GetFullPathNameA(__stringVal(aPathName), MAXPATHLEN, nameBuffer, NULL);
+ char _aPathName[MAXPATHLEN+1];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ rslt = STX_API_NOINT_CALL4( "GetFullPathNameA", GetFullPathNameA, _aPathName, MAXPATHLEN, nameBuffer, NULL);
+ } while ((rslt < 0) && (__threadErrno == EINTR));
+#else
+ rslt = GetFullPathNameA(__stringVal(aPathName), MAXPATHLEN, nameBuffer, NULL);
#endif
returnedName = nameBuffer;
@@ -5901,27 +5901,27 @@
RETURN (nil);
}
if (__isUnicode16String(aPathName)) {
- wchar_t nameBuffer[MAXPATHLEN + 1];
- wchar_t nameBuffer2[MAXPATHLEN + 1];
- wchar_t *returnedName = NULL;
- int rslt;
- wchar_t _aPathName[MAXPATHLEN+1];
- int i, l;
-
- l = __unicode16StringSize(aPathName);
- if (l > MAXPATHLEN) l = MAXPATHLEN;
- for (i=0; i<l; i++) {
- _aPathName[i] = __unicode16StringVal(aPathName)[i];
- }
- _aPathName[i] = 0;
+ wchar_t nameBuffer[MAXPATHLEN + 1];
+ wchar_t nameBuffer2[MAXPATHLEN + 1];
+ wchar_t *returnedName = NULL;
+ int rslt;
+ wchar_t _aPathName[MAXPATHLEN+1];
+ int i, l;
+
+ l = __unicode16StringSize(aPathName);
+ if (l > MAXPATHLEN) l = MAXPATHLEN;
+ for (i=0; i<l; i++) {
+ _aPathName[i] = __unicode16StringVal(aPathName)[i];
+ }
+ _aPathName[i] = 0;
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- rslt = STX_API_NOINT_CALL4( "GetFullPathNameW", GetFullPathNameW, _aPathName, MAXPATHLEN, nameBuffer, NULL);
- } while ((rslt < 0) && (__threadErrno == EINTR));
-#else
- rslt = GetFullPathNameW(_aPathName, MAXPATHLEN, nameBuffer, NULL);
+ do {
+ __threadErrno = 0;
+ rslt = STX_API_NOINT_CALL4( "GetFullPathNameW", GetFullPathNameW, _aPathName, MAXPATHLEN, nameBuffer, NULL);
+ } while ((rslt < 0) && (__threadErrno == EINTR));
+#else
+ rslt = GetFullPathNameW(_aPathName, MAXPATHLEN, nameBuffer, NULL);
#endif
returnedName = nameBuffer;
@@ -7163,30 +7163,17 @@
!
primGetLastError
-%{ /* NOCONTEXT */
- DWORD e;
-
- e = GetLastError();
- RETURN(__MKUINT(e));
-%}.
-
- "/ <apicall: dword "GetLastError" () module: "kernel32.dll" >
+
+ <apicall: dword "GetLastError" () module: "kernel32.dll" >
"
self primGetLastError
"
!
-primSetLastError: i
-%{ /* NOCONTEXT */
- if (__isSmallInteger(i)) {
- SetLastError(__intVal(i));
- RETURN(self);
- }
-%}.
- self primitiveFailed.
-
- "/ <apicall: void "SetLastError" (dword) module: "kernel32.dll" >
+primSetLastError: int
+
+ <apicall: void "SetLastError" (dword) module: "kernel32.dll" >
"
self primSetLastError: 0
@@ -7795,8 +7782,8 @@
getNetworkMACAddresses
"return a dictionary filled with
- key -> name of interface
- value -> the MAC adress (as ByteArray)
+ key -> name of interface
+ value -> the MAC adress (as ByteArray)
for each interface
"
@@ -7858,16 +7845,16 @@
"Keep the order as reurned by the OS"
info := OrderedDictionary new:nAdapters.
nAdapters notNil ifTrue:[
- 1 to:nAdapters do:[:i |
- |entry name description macAddr ipAddr|
-
- entry := rawData at:i.
- name := entry at:1.
- "/ description := entry at:2.
- macAddr := entry at:3.
- "/ ipAddr := entry at:4.
- info at:name put:macAddr.
- ].
+ 1 to:nAdapters do:[:i |
+ |entry name description macAddr ipAddr|
+
+ entry := rawData at:i.
+ name := entry at:1.
+ "/ description := entry at:2.
+ macAddr := entry at:3.
+ "/ ipAddr := entry at:4.
+ info at:name put:macAddr.
+ ].
].
^ info
@@ -11651,9 +11638,9 @@
isSpecialFile
^ (type ~~ #directory
- and:[type ~~ #remoteDirectory
- and:[type ~~ #regular
- and:[type ~~ #symbolicLink
+ and:[type ~~ #remoteDirectory
+ and:[type ~~ #regular
+ and:[type ~~ #symbolicLink
]]])
!
@@ -17133,15 +17120,15 @@
!Win32OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.464 2013-05-28 12:44:56 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.462 2013-05-15 17:06:14 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.464 2013-05-28 12:44:56 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.462 2013-05-15 17:06:14 stefan Exp $'
!
version_SVN
- ^ '$Id: Win32OperatingSystem.st,v 1.464 2013-05-28 12:44:56 cg Exp $'
+ ^ '$Id: Win32OperatingSystem.st,v 1.462 2013-05-15 17:06:14 stefan Exp $'
! !