--- a/Win32OperatingSystem.st Thu Oct 30 16:31:05 2008 +0100
+++ b/Win32OperatingSystem.st Thu Oct 30 16:33:29 2008 +0100
@@ -4527,7 +4527,7 @@
^ (s copyFrom:1 to: size) asSingleByteStringIfPossible
"
- self getCurrentDirectory
+ self getCurrentDirectory
"
!
@@ -4668,13 +4668,13 @@
getDriveType:aPathName
"returns:
- 0 -> Unknown
- 1 -> Invalid
- 2 -> removable
- 3 -> fixed
- 4 -> remote
- 5 -> cdrom
- 6 -> ramdisk.
+ 0 -> Unknown
+ 1 -> Invalid
+ 2 -> removable
+ 3 -> fixed
+ 4 -> remote
+ 5 -> cdrom
+ 6 -> ramdisk.
This is a stupid interface - do not use."
%{
@@ -4682,27 +4682,27 @@
if (__isString(aPathName)) {
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetDriveType", GetDriveType, _aPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributes((char *) __stringVal(aPathName));
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- RETURN (__MKSMALLINT(ret));
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetDriveType", GetDriveType, _aPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributes((char *) __stringVal(aPathName));
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ RETURN (__MKSMALLINT(ret));
}
%}.
^ self primitiveFailed
"
- self getDriveType:'x:\'
- self getDriveType:'C:\'
+ self getDriveType:'x:\'
+ self getDriveType:'C:\'
self getDriveType:'D:\'
"
!
@@ -4819,61 +4819,61 @@
if (__isString(aPathName)) {
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributesA((char *) __stringVal(aPathName));
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN ( false );
- }
- RETURN ( (ret & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributesA((char *) __stringVal(aPathName));
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN ( false );
+ }
+ RETURN ( (ret & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
}
if (__isUnicode16String(aPathName)) {
- wchar_t _wPathName[MAXPATHLEN+1];
- int i, l;
-
- l = __unicode16StringSize(aPathName);
- if (l > MAXPATHLEN) l = MAXPATHLEN;
- for (i=0; i<l; i++) {
- _wPathName[i] = __unicode16StringVal(aPathName)[i];
- }
- _wPathName[i] = 0;
+ wchar_t _wPathName[MAXPATHLEN+1];
+ int i, l;
+
+ l = __unicode16StringSize(aPathName);
+ if (l > MAXPATHLEN) l = MAXPATHLEN;
+ for (i=0; i<l; i++) {
+ _wPathName[i] = __unicode16StringVal(aPathName)[i];
+ }
+ _wPathName[i] = 0;
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributesW(_wPathName);
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN ( false );
- }
- RETURN ( (ret & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributesW(_wPathName);
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN ( false );
+ }
+ RETURN ( (ret & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
}
%}.
^ self primitiveFailed
"an alternative implementation would be:
- ^ (self infoOf:aPathName) type == #directory
- "
- "
- self isDirectory:'.'
+ ^ (self infoOf:aPathName) type == #directory
+ "
+ "
+ self isDirectory:'.'
self isDirectory:'.' asUnicode16String
"
@@ -4901,59 +4901,59 @@
if (__isString(aPathName)) {
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributes((char *) __stringVal(aPathName));
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN ( false );
- }
- RETURN ( (ret & FILE_ATTRIBUTE_HIDDEN) ? true : false);
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributes((char *) __stringVal(aPathName));
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN ( false );
+ }
+ RETURN ( (ret & FILE_ATTRIBUTE_HIDDEN) ? true : false);
}
if (__isUnicode16String(aPathName)) {
- wchar_t _wPathName[MAXPATHLEN+1];
- int i, l;
-
- l = __unicode16StringSize(aPathName);
- if (l > MAXPATHLEN) l = MAXPATHLEN;
- for (i=0; i<l; i++) {
- _wPathName[i] = __unicode16StringVal(aPathName)[i];
- }
- _wPathName[i] = 0;
+ wchar_t _wPathName[MAXPATHLEN+1];
+ int i, l;
+
+ l = __unicode16StringSize(aPathName);
+ if (l > MAXPATHLEN) l = MAXPATHLEN;
+ for (i=0; i<l; i++) {
+ _wPathName[i] = __unicode16StringVal(aPathName)[i];
+ }
+ _wPathName[i] = 0;
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributesW(_wPathName);
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN ( false );
- }
- RETURN ( (ret & FILE_ATTRIBUTE_HIDDEN) ? true : false);
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributesW(_wPathName);
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN ( false );
+ }
+ RETURN ( (ret & FILE_ATTRIBUTE_HIDDEN) ? true : false);
}
%}.
^ self primitiveFailed
"
- self isHidden:'.'
- self isHidden:'.' asUnicode16String
+ self isHidden:'.'
+ self isHidden:'.' asUnicode16String
"
!
@@ -4963,72 +4963,72 @@
%{
if (__isString(aPathName)) {
- int ret;
-
- /*
- * under windows, all files are readable ...
- * so, only check for the files existence here.
- */
+ int ret;
+
+ /*
+ * under windows, all files are readable ...
+ * so, only check for the files existence here.
+ */
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributesA((char *) __stringVal(aPathName));
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN (false);
- }
- RETURN (true);
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributesA((char *) __stringVal(aPathName));
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN (false);
+ }
+ RETURN (true);
}
if (__isUnicode16String(aPathName)) {
- int ret;
-
- /*
- * under windows, all files are readable ...
- * so, only check for the files existence here.
- */
- wchar_t _wPathName[MAXPATHLEN+1];
- int i, l;
-
- l = __unicode16StringSize(aPathName);
- if (l > MAXPATHLEN) l = MAXPATHLEN;
- for (i=0; i<l; i++) {
- _wPathName[i] = __unicode16StringVal(aPathName)[i];
- }
- _wPathName[i] = 0;
+ int ret;
+
+ /*
+ * under windows, all files are readable ...
+ * so, only check for the files existence here.
+ */
+ wchar_t _wPathName[MAXPATHLEN+1];
+ int i, l;
+
+ l = __unicode16StringSize(aPathName);
+ if (l > MAXPATHLEN) l = MAXPATHLEN;
+ for (i=0; i<l; i++) {
+ _wPathName[i] = __unicode16StringVal(aPathName)[i];
+ }
+ _wPathName[i] = 0;
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributesW(_wPathName);
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN (false);
- }
- RETURN (true);
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributesW(_wPathName);
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN (false);
+ }
+ RETURN (true);
}
%}.
^ self primitiveFailed
"
- self isReadable:'.'
- self isReadable:'.' asUnicode16String
+ self isReadable:'.'
+ self isReadable:'.' asUnicode16String
"
!
@@ -5041,52 +5041,52 @@
if (__isString(aPathName) || __isSymbol(aPathName)) {
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributesA((char *) __stringVal(aPathName));
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN ( false );
- }
- RETURN (true);
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributesA((char *) __stringVal(aPathName));
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN ( false );
+ }
+ RETURN (true);
}
if (__isUnicode16String(aPathName)) {
- wchar_t _wPathName[MAXPATHLEN+1];
- int i, l;
-
- l = __unicode16StringSize(aPathName);
- if (l > MAXPATHLEN) l = MAXPATHLEN;
- for (i=0; i<l; i++) {
- _wPathName[i] = __unicode16StringVal(aPathName)[i];
- }
- _wPathName[i] = 0;
+ wchar_t _wPathName[MAXPATHLEN+1];
+ int i, l;
+
+ l = __unicode16StringSize(aPathName);
+ if (l > MAXPATHLEN) l = MAXPATHLEN;
+ for (i=0; i<l; i++) {
+ _wPathName[i] = __unicode16StringVal(aPathName)[i];
+ }
+ _wPathName[i] = 0;
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributesW(_wPathName);
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN ( false );
- }
- RETURN (true);
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributesW(_wPathName);
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN ( false );
+ }
+ RETURN (true);
}
%}.
^ self primitiveFailed
@@ -5103,64 +5103,64 @@
if (__isString(aPathName)) {
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributes((char *) __stringVal(aPathName));
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN ( false );
- }
- RETURN ( (ret & FILE_ATTRIBUTE_READONLY) ? false : true);
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributes((char *) __stringVal(aPathName));
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN ( false );
+ }
+ RETURN ( (ret & FILE_ATTRIBUTE_READONLY) ? false : true);
}
if (__isUnicode16String(aPathName)) {
- int ret;
-
- /*
- * under windows, all files are readable ...
- * so, only check for the files existence here.
- */
- wchar_t _wPathName[MAXPATHLEN+1];
- int i, l;
-
- l = __unicode16StringSize(aPathName);
- if (l > MAXPATHLEN) l = MAXPATHLEN;
- for (i=0; i<l; i++) {
- _wPathName[i] = __unicode16StringVal(aPathName)[i];
- }
- _wPathName[i] = 0;
+ int ret;
+
+ /*
+ * under windows, all files are readable ...
+ * so, only check for the files existence here.
+ */
+ wchar_t _wPathName[MAXPATHLEN+1];
+ int i, l;
+
+ l = __unicode16StringSize(aPathName);
+ if (l > MAXPATHLEN) l = MAXPATHLEN;
+ for (i=0; i<l; i++) {
+ _wPathName[i] = __unicode16StringVal(aPathName)[i];
+ }
+ _wPathName[i] = 0;
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
- } while ((ret < 0) && (__threadErrno == EINTR));
-#else
- ret = GetFileAttributesW(_wPathName);
- if (ret < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
- RETURN (false);
- }
- RETURN ( (ret & FILE_ATTRIBUTE_READONLY) ? false : true);
+ do {
+ __threadErrno = 0;
+ ret = STX_API_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
+ } while ((ret < 0) && (__threadErrno == EINTR));
+#else
+ ret = GetFileAttributesW(_wPathName);
+ if (ret < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ RETURN (false);
+ }
+ RETURN ( (ret & FILE_ATTRIBUTE_READONLY) ? false : true);
}
%}.
^ self primitiveFailed
"
- self isWritable:'.'
- self isWritable:'.' asUnicode16String
+ self isWritable:'.'
+ self isWritable:'.' asUnicode16String
"
!
@@ -5168,16 +5168,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.
@@ -5209,165 +5209,165 @@
wchar_t _aPathName[MAX_PATH+1];
if (__isString(aPathName)) {
- int i;
- int l = __stringSize(aPathName);
- if (l > MAX_PATH) l = MAX_PATH;
-
- for (i=0; i<l; i++) {
- _aPathName[i] = __stringVal(aPathName)[i];
- }
- _aPathName[i] = 0;
+ int i;
+ int l = __stringSize(aPathName);
+ if (l > MAX_PATH) l = MAX_PATH;
+
+ 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 > MAX_PATH) l = MAX_PATH;
-
- for (i=0; i<l; i++) {
- _aPathName[i] = __unicode16StringVal(aPathName)[i];
- }
- _aPathName[i] = 0;
+ int i;
+ int l = __unicode16StringSize(aPathName);
+ if (l > MAX_PATH) l = MAX_PATH;
+
+ 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;
- hFile = STX_API_CALL2( "FindFirstFileW", FindFirstFileW, _aPathName, &findStructW);
- } while ((hFile < 0) && (__threadErrno == EINTR));
+ do {
+ __threadErrno = 0;
+ hFile = STX_API_CALL2( "FindFirstFileW", FindFirstFileW, _aPathName, &findStructW);
+ } while ((hFile < 0) && (__threadErrno == EINTR));
}
#else
hFile = FindFirstFileW(_aPathName, &findStructW);
if (hFile < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
+ __threadErrno = __WIN32_ERR(GetLastError());
}
#endif
if (! hFile || (hFile == (HANDLE)(-1)) || (hFile == INVALID_HANDLE_VALUE)) {
- @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
+ @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
} else {
- FindClose(hFile);
-
- id = __mkSmallInteger(0); /* could get it by opening ... */
- size = __MKLARGEINT64(1, findStructW.nFileSizeLow, findStructW.nFileSizeHigh);
-
- if (findStructW.cFileName[0] != '\0') {
- bcopy(findStructW.cFileName, fileNameBuffer, MAX_PATH*sizeof(wchar_t));
- fileNameBuffer[MAX_PATH] = '\0';
- fileName = __MKU16STRING(fileNameBuffer); /* FULL name */
- }
-
- if (findStructW.cAlternateFileName[0] != '\0') {
- bcopy(findStructW.cAlternateFileName, alternativeFileNameBuffer, 14*sizeof(wchar_t));
- alternativeFileNameBuffer[14] = '\0';
- alternativeName = __MKU16STRING(alternativeFileNameBuffer); /* DOS name */
- }
-
- /*
- * simulate access bits
- */
- if (findStructW.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
- modeBits = 0444;
- } else {
- modeBits = 0666;
- }
-
- if (findStructW.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
- type = @symbol(directory);
- modeBits |= 0111; /* executable */
- } else {
- type = @symbol(regular);
- }
-
- mode = __mkSmallInteger(modeBits);
-
- /*
- * sigh - convert from stupid time to useful time
- */
- FileTimeToLocalFileTime(&findStructW.ftCreationTime, &tempFileTime);
- FileTimeToSystemTime(&tempFileTime, &creationTime);
-
- FileTimeToLocalFileTime(&findStructW.ftLastAccessTime, &tempFileTime);
- FileTimeToSystemTime(&tempFileTime, &accessTime);
-
- FileTimeToLocalFileTime(&findStructW.ftLastWriteTime, &tempFileTime);
- FileTimeToSystemTime(&tempFileTime, &modificationTime);
-
- aYr = __mkSmallInteger(accessTime.wYear);
- aMon = __mkSmallInteger(accessTime.wMonth);
- aDay = __mkSmallInteger(accessTime.wDay);
- aHr = __mkSmallInteger(accessTime.wHour);
- aMin = __mkSmallInteger(accessTime.wMinute);
- aSec = __mkSmallInteger(accessTime.wSecond);
- aMS = __mkSmallInteger(accessTime.wMilliseconds);
-
- mYr = __mkSmallInteger(modificationTime.wYear);
- mMon = __mkSmallInteger(modificationTime.wMonth);
- mDay = __mkSmallInteger(modificationTime.wDay);
- mHr = __mkSmallInteger(modificationTime.wHour);
- mMin = __mkSmallInteger(modificationTime.wMinute);
- mSec = __mkSmallInteger(modificationTime.wSecond);
- mMS = __mkSmallInteger(modificationTime.wMilliseconds);
-
- cYr = __mkSmallInteger(creationTime.wYear);
- cMon = __mkSmallInteger(creationTime.wMonth);
- cDay = __mkSmallInteger(creationTime.wDay);
- cHr = __mkSmallInteger(creationTime.wHour);
- cMin = __mkSmallInteger(creationTime.wMinute);
- cSec = __mkSmallInteger(creationTime.wSecond);
- cMS = __mkSmallInteger(creationTime.wMilliseconds);
+ FindClose(hFile);
+
+ id = __mkSmallInteger(0); /* could get it by opening ... */
+ size = __MKLARGEINT64(1, findStructW.nFileSizeLow, findStructW.nFileSizeHigh);
+
+ if (findStructW.cFileName[0] != '\0') {
+ bcopy(findStructW.cFileName, fileNameBuffer, MAX_PATH*sizeof(wchar_t));
+ fileNameBuffer[MAX_PATH] = '\0';
+ fileName = __MKU16STRING(fileNameBuffer); /* FULL name */
+ }
+
+ if (findStructW.cAlternateFileName[0] != '\0') {
+ bcopy(findStructW.cAlternateFileName, alternativeFileNameBuffer, 14*sizeof(wchar_t));
+ alternativeFileNameBuffer[14] = '\0';
+ alternativeName = __MKU16STRING(alternativeFileNameBuffer); /* DOS name */
+ }
+
+ /*
+ * simulate access bits
+ */
+ if (findStructW.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
+ modeBits = 0444;
+ } else {
+ modeBits = 0666;
+ }
+
+ if (findStructW.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
+ type = @symbol(directory);
+ modeBits |= 0111; /* executable */
+ } else {
+ type = @symbol(regular);
+ }
+
+ mode = __mkSmallInteger(modeBits);
+
+ /*
+ * sigh - convert from stupid time to useful time
+ */
+ FileTimeToLocalFileTime(&findStructW.ftCreationTime, &tempFileTime);
+ FileTimeToSystemTime(&tempFileTime, &creationTime);
+
+ FileTimeToLocalFileTime(&findStructW.ftLastAccessTime, &tempFileTime);
+ FileTimeToSystemTime(&tempFileTime, &accessTime);
+
+ FileTimeToLocalFileTime(&findStructW.ftLastWriteTime, &tempFileTime);
+ FileTimeToSystemTime(&tempFileTime, &modificationTime);
+
+ aYr = __mkSmallInteger(accessTime.wYear);
+ aMon = __mkSmallInteger(accessTime.wMonth);
+ aDay = __mkSmallInteger(accessTime.wDay);
+ aHr = __mkSmallInteger(accessTime.wHour);
+ aMin = __mkSmallInteger(accessTime.wMinute);
+ aSec = __mkSmallInteger(accessTime.wSecond);
+ aMS = __mkSmallInteger(accessTime.wMilliseconds);
+
+ mYr = __mkSmallInteger(modificationTime.wYear);
+ mMon = __mkSmallInteger(modificationTime.wMonth);
+ mDay = __mkSmallInteger(modificationTime.wDay);
+ mHr = __mkSmallInteger(modificationTime.wHour);
+ mMin = __mkSmallInteger(modificationTime.wMinute);
+ mSec = __mkSmallInteger(modificationTime.wSecond);
+ mMS = __mkSmallInteger(modificationTime.wMilliseconds);
+
+ cYr = __mkSmallInteger(creationTime.wYear);
+ cMon = __mkSmallInteger(creationTime.wMonth);
+ cDay = __mkSmallInteger(creationTime.wDay);
+ cHr = __mkSmallInteger(creationTime.wHour);
+ cMin = __mkSmallInteger(creationTime.wMinute);
+ cSec = __mkSmallInteger(creationTime.wSecond);
+ cMS = __mkSmallInteger(creationTime.wMilliseconds);
}
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 day:aDay month:aMon year:aYr hour:aHr minutes:aMin seconds:aSec milliseconds:aMS.
- ].
- mtime isNil ifTrue:[
- mtime := Timestamp day:mDay month:mMon year:mYr hour:mHr minutes:mMin seconds:mSec milliseconds:mMS.
- ].
- ctime isNil ifTrue:[
- ctime := Timestamp day:cDay month:cMon year:cYr hour:cHr minutes:cMin seconds:cSec milliseconds:cMS.
- ].
- 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 day:aDay month:aMon year:aYr hour:aHr minutes:aMin seconds:aSec milliseconds:aMS.
+ ].
+ mtime isNil ifTrue:[
+ mtime := Timestamp day:mDay month:mMon year:mYr hour:mHr minutes:mMin seconds:mSec milliseconds:mMS.
+ ].
+ ctime isNil ifTrue:[
+ ctime := Timestamp day:cDay month:cMon year:cYr hour:cHr minutes:cMin seconds:cSec milliseconds:cMS.
+ ].
+ 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
@@ -5514,110 +5514,109 @@
from what you expect."
%{ /* xxSTACK: 16000 */
-#define NO_NT4_0_COMPATIBILITY
if (__isStringLike(aPathName)) {
- char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
- char *pFinal;
- int rslt;
+ char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
+ char *pFinal;
+ int rslt;
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- rslt = STX_API_CALL4( "GetFullPathName", GetFullPathName, _aPathName, sizeof(nameBuffer), nameBuffer, &pFinal);
- } while ((rslt < 0) && (__threadErrno == EINTR));
-#else
- rslt = GetFullPathName(__stringVal(aPathName), sizeof(nameBuffer), nameBuffer, &pFinal);
-#endif
-
- if (rslt > 0) {
- /*
- * Attention: GetLongPathName is not available on old NT4.0/W95/W98
- */
- static FARPROC GetLongPathName_entry = NULL;
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ rslt = STX_API_CALL4( "GetFullPathName", GetFullPathName, _aPathName, sizeof(nameBuffer), nameBuffer, &pFinal);
+ } while ((rslt < 0) && (__threadErrno == EINTR));
+#else
+ rslt = GetFullPathName(__stringVal(aPathName), sizeof(nameBuffer), nameBuffer, &pFinal);
+#endif
+
+ if (rslt > 0) {
+ /*
+ * Attention: GetLongPathName is not available on old NT4.0/W95/W98
+ */
+ static FARPROC GetLongPathName_entry = NULL;
#ifdef NO_NT4_0_COMPATIBILITY
- GetLongPathName_entry = (FARPROC) GetLongPathName;
-#else
- if (GetLongPathName_entry == NULL) {
- GetLongPathName_entry = __get_kernel32_functionAddress("GetLongPathNameA");
- }
+ GetLongPathName_entry = (FARPROC) GetLongPathName;
+#else
+ if (GetLongPathName_entry == NULL) {
+ GetLongPathName_entry = __get_kernel32_functionAddress("GetLongPathNameA");
+ }
#endif /* NO_NT4_0_COMPATIBILITY */
- if (GetLongPathName_entry) {
+ if (GetLongPathName_entry) {
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- rslt = STX_API_CALL3( "GetLongPathName", GetLongPathName_entry, nameBuffer, nameBuffer, sizeof(nameBuffer));
- } while ((rslt < 0) && (__threadErrno == EINTR));
-#else
- rslt = (*GetLongPathName_entry)(nameBuffer, nameBuffer, sizeof(nameBuffer));
-#endif
- }
- }
- if (rslt > 0) {
- RETURN ( __MKSTRING(nameBuffer) );
- }
- __threadErrno = __WIN32_ERR(GetLastError());
- RETURN (nil);
+ do {
+ __threadErrno = 0;
+ rslt = STX_API_CALL3( "GetLongPathName", GetLongPathName_entry, nameBuffer, nameBuffer, sizeof(nameBuffer));
+ } while ((rslt < 0) && (__threadErrno == EINTR));
+#else
+ rslt = (*GetLongPathName_entry)(nameBuffer, nameBuffer, sizeof(nameBuffer));
+#endif
+ }
+ }
+ if (rslt > 0) {
+ RETURN ( __MKSTRING(nameBuffer) );
+ }
+ __threadErrno = __WIN32_ERR(GetLastError());
+ RETURN (nil);
}
if (__isUnicode16String(aPathName)) {
- wchar_t nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
- char *pFinal;
- 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 + MAXPATHLEN + 1];
+ char *pFinal;
+ 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_CALL4( "GetFullPathNameW", GetFullPathNameW, _aPathName, MAXPATHLEN, nameBuffer, &pFinal);
- } while ((rslt < 0) && (__threadErrno == EINTR));
-#else
- rslt = GetFullPathName(_aPathName, MAXPATHLEN, nameBuffer, &pFinal);
-#endif
- if (rslt > 0) {
- /*
- * Attention: GetLongPathName is not available on old NT4.0/W95/W98
- */
- static FARPROC GetLongPathNameW_entry = NULL;
+ do {
+ __threadErrno = 0;
+ rslt = STX_API_CALL4( "GetFullPathNameW", GetFullPathNameW, _aPathName, MAXPATHLEN, nameBuffer, &pFinal);
+ } while ((rslt < 0) && (__threadErrno == EINTR));
+#else
+ rslt = GetFullPathName(_aPathName, MAXPATHLEN, nameBuffer, &pFinal);
+#endif
+ if (rslt > 0) {
+ /*
+ * Attention: GetLongPathName is not available on old NT4.0/W95/W98
+ */
+ static FARPROC GetLongPathNameW_entry = NULL;
#ifdef NO_NT4_0_COMPATIBILITY
- GetLongPathNameW_entry = (FARPROC) GetLongPathNameW;
-#else
- if (GetLongPathNameW_entry == NULL) {
- GetLongPathNameW_entry = __get_kernel32_functionAddress("GetLongPathNameW");
- }
+ GetLongPathNameW_entry = (FARPROC) GetLongPathNameW;
+#else
+ if (GetLongPathNameW_entry == NULL) {
+ GetLongPathNameW_entry = __get_kernel32_functionAddress("GetLongPathNameW");
+ }
#endif /* NO_NT4_0_COMPATIBILITY */
- if (GetLongPathNameW_entry) {
+ if (GetLongPathNameW_entry) {
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- rslt = STX_API_CALL3( "GetLongPathNameW", GetLongPathNameW_entry, nameBuffer, nameBuffer, MAXPATHLEN);
- } while ((rslt < 0) && (__threadErrno == EINTR));
-#else
- rslt = (*GetLongPathNameW_entry)(nameBuffer, nameBuffer, MAXPATHLEN);
-#endif
- }
- }
- if (rslt > 0) {
- RETURN ( __MKU16STRING(nameBuffer) );
- }
- __threadErrno = __WIN32_ERR(GetLastError());
+ do {
+ __threadErrno = 0;
+ rslt = STX_API_CALL3( "GetLongPathNameW", GetLongPathNameW_entry, nameBuffer, nameBuffer, MAXPATHLEN);
+ } while ((rslt < 0) && (__threadErrno == EINTR));
+#else
+ rslt = (*GetLongPathNameW_entry)(nameBuffer, nameBuffer, MAXPATHLEN);
+#endif
+ }
+ }
+ if (rslt > 0) {
+ RETURN ( __MKU16STRING(nameBuffer) );
+ }
+ __threadErrno = __WIN32_ERR(GetLastError());
}
%}.
^ nil
"
- self primPathNameOf:'.'
+ self primPathNameOf:'.'
self primPathNameOf:'.' asUnicode16String
"
!
@@ -10825,11 +10824,11 @@
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT created:cT sourcePath:lP fullName:fullName alternativeName:name2
^ self basicNew
- type:t mode:m uid:u gid:g size:s
- id:i accessed:aT modified:mT created:cT
- sourcePath:lP
- fullName:fullName
- alternativeName:name2
+ type:t mode:m uid:u gid:g size:s
+ id:i accessed:aT modified:mT created:cT
+ sourcePath:lP
+ fullName:fullName
+ alternativeName:name2
! !
!Win32OperatingSystem::FileStatusInfo methodsFor:'accessing'!
@@ -10885,9 +10884,9 @@
"/ access lazily...
linkTargetPath isNil ifTrue:[
- type == #symbolicLink ifTrue:[
- linkTargetPath := OperatingSystem getLinkTarget:sourcePath.
- ]
+ type == #symbolicLink ifTrue:[
+ linkTargetPath := OperatingSystem getLinkTarget:sourcePath.
+ ]
].
^ linkTargetPath
@@ -15836,7 +15835,7 @@
!Win32OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.352 2008-10-30 15:30:33 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.353 2008-10-30 15:33:29 cg Exp $'
! !
Win32OperatingSystem initialize!