diff --git a/platforms/unix/plugins/FileAttributesPlugin/faSupport.c b/platforms/unix/plugins/FileAttributesPlugin/faSupport.c index 4b54b1f1f8..5aa6957024 100644 --- a/platforms/unix/plugins/FileAttributesPlugin/faSupport.c +++ b/platforms/unix/plugins/FileAttributesPlugin/faSupport.c @@ -263,10 +263,12 @@ sqInt faOpenDirectory(fapath *aFaPath) sqInt faReadDirectory(fapath *aFaPath) { -sqInt haveEntry; +sqInt haveEntry; struct dirent *entry; -sqInt status; +sqInt status; + if (aFaPath->platformDir == NULL) + return FA_CORRUPT_VALUE; haveEntry = 0; errno = 0; do { @@ -296,8 +298,10 @@ sqInt status; sqInt faCloseDirectory(fapath *aFaPath) { - sqInt status; +sqInt status; + if (aFaPath->platformDir == NULL) + return FA_CORRUPT_VALUE; status = closedir(aFaPath->platformDir); if (status) return FA_UNABLE_TO_CLOSE_DIR; aFaPath->platformDir = 0; @@ -307,6 +311,23 @@ sqInt faCloseDirectory(fapath *aFaPath) +/* + * faRewindDirectory + * + * Rewind the supplied directory and answer the first entry. + */ + +sqInt faRewindDirectory(fapath *aFaPath) +{ + + if (aFaPath->platformDir == NULL) + return FA_CORRUPT_VALUE; + rewinddir(aFaPath->platformDir); + return faReadDirectory(aFaPath); +} + + + /* * faFileAttribute * diff --git a/platforms/unix/plugins/FileAttributesPlugin/faSupport.h b/platforms/unix/plugins/FileAttributesPlugin/faSupport.h index f8217e2a8c..566a5a1174 100644 --- a/platforms/unix/plugins/FileAttributesPlugin/faSupport.h +++ b/platforms/unix/plugins/FileAttributesPlugin/faSupport.h @@ -74,6 +74,7 @@ sqLong faConvertUnixToLongSqueakTime(time_t unixTime); sqInt faOpenDirectory(fapath *aFaPath); sqInt faReadDirectory(fapath *aFaPath); sqInt faCloseDirectory(fapath *aFaPath); +sqInt faRewindDirectory(fapath *aFaPath); sqInt faFileAttribute(fapath *aFaPath, sqInt attributeNumber); sqInt faStat(fapath *aFaPath, faStatStruct *statBuf, sqInt *fileNameOop); sqInt faLinkStat(fapath *aFaPath, faStatStruct *statBuf, sqInt *fileNameOop); diff --git a/platforms/win32/plugins/FileAttributesPlugin/faSupport.c b/platforms/win32/plugins/FileAttributesPlugin/faSupport.c index 26949b8b51..73ab201d5d 100644 --- a/platforms/win32/plugins/FileAttributesPlugin/faSupport.c +++ b/platforms/win32/plugins/FileAttributesPlugin/faSupport.c @@ -29,19 +29,20 @@ sqInt status; /* Convert to platform specific form Include the \\?\ prefix to allow long path names */ - aFaPath->winpath[0] = L'\\'; - aFaPath->winpath[1] = L'\\'; - aFaPath->winpath[2] = L'?'; - aFaPath->winpath[3] = L'\\'; + aFaPath->winpathLPP[0] = L'\\'; + aFaPath->winpathLPP[1] = L'\\'; + aFaPath->winpathLPP[2] = L'?'; + aFaPath->winpathLPP[3] = L'\\'; + aFaPath->winpath = aFaPath->winpathLPP + 4; status = MultiByteToWideChar(CP_UTF8, 0, aFaPath->path, -1, - aFaPath->winpath+4, FA_PATH_MAX); + aFaPath->winpath, FA_PATH_MAX); if (!status) return interpreterProxy->primitiveFailForOSError(FA_STRING_TOO_LONG); /* Set aFaPath->uxpath_file and max_file_len to the buffer after the directory */ - aFaPath->winpath2 = aFaPath->winpath+4; - aFaPath->winpath_len = wcslen(aFaPath->winpath); - aFaPath->winpath_file = aFaPath->winpath + aFaPath->winpath_len; + aFaPath->winpathLPP_len = wcslen(aFaPath->winpathLPP); + aFaPath->winpath_len = aFaPath->winpathLPP_len - 4; + aFaPath->winpath_file = aFaPath->winpathLPP + aFaPath->winpathLPP_len; aFaPath->winmax_file_len = FA_PATH_MAX - aFaPath->winpath_len; return 0; @@ -64,18 +65,19 @@ sqInt status; /* Convert to platform specific form Include the \\?\ prefix to allow long path names */ - aFaPath->winpath[0] = L'\\'; - aFaPath->winpath[1] = L'\\'; - aFaPath->winpath[2] = L'?'; - aFaPath->winpath[3] = L'\\'; + aFaPath->winpathLPP[0] = L'\\'; + aFaPath->winpathLPP[1] = L'\\'; + aFaPath->winpathLPP[2] = L'?'; + aFaPath->winpathLPP[3] = L'\\'; + aFaPath->winpath = aFaPath->winpathLPP + 4; status = MultiByteToWideChar(CP_UTF8, 0, aFaPath->path, -1, - aFaPath->winpath+4, FA_PATH_MAX); + aFaPath->winpath, FA_PATH_MAX); if (!status) return interpreterProxy->primitiveFailForOSError(FA_STRING_TOO_LONG); /* Set aFaPath->uxpath_file and max_file_len to the buffer after the directory */ - aFaPath->winpath2 = aFaPath->winpath+4; - aFaPath->winpath_len = wcslen(aFaPath->winpath); + aFaPath->winpathLPP_len = wcslen(aFaPath->winpathLPP); + aFaPath->winpath_len = aFaPath->winpathLPP_len - 4; aFaPath->winpath_file = 0; aFaPath->winmax_file_len = 0; @@ -108,26 +110,30 @@ sqInt status; +/* + * faSetPlatPath + * + * The supplied pathName must not include the Long Path Prefix (\\?\). + */ sqInt faSetPlatPath(fapath *aFaPath, WCHAR *pathName) { int len; - /* Set the platform encoded path */ len = wcslen(pathName); if (len >= FA_PATH_MAX) return interpreterProxy->primitiveFailForOSError(FA_STRING_TOO_LONG); + /* Set the platform encoded path */ + aFaPath->winpathLPP[0] = L'\\'; + aFaPath->winpathLPP[1] = L'\\'; + aFaPath->winpathLPP[2] = L'?'; + aFaPath->winpathLPP[3] = L'\\'; + aFaPath->winpath = aFaPath->winpathLPP + 4; wcscpy(aFaPath->winpath, pathName); aFaPath->winpath[len] = 0; aFaPath->winpath_len = len; aFaPath->winpath_file = 0; aFaPath->winmax_file_len = 0; - if (aFaPath->winpath[0] == L'\\' && - aFaPath->winpath[1] == L'\\' && - aFaPath->winpath[2] == L'?' && - aFaPath->winpath[3] == L'\\') - aFaPath->winpath2 = aFaPath->winpath + 4; - else - aFaPath->winpath2 = aFaPath->winpath; + aFaPath->winpathLPP_len = aFaPath->winpath_len + 4; /* Convert to St specific form */ len = WideCharToMultiByte(CP_UTF8, @@ -161,18 +167,18 @@ int len; len = byteCount / sizeof(WCHAR); if (len >= FA_PATH_MAX) return interpreterProxy->primitiveFailForOSError(FA_STRING_TOO_LONG); + + aFaPath->winpathLPP[0] = L'\\'; + aFaPath->winpathLPP[1] = L'\\'; + aFaPath->winpathLPP[2] = L'?'; + aFaPath->winpathLPP[3] = L'\\'; + aFaPath->winpath = aFaPath->winpathLPP + 4; memcpy(aFaPath->winpath, bytePtr, byteCount); aFaPath->winpath[len] = 0; aFaPath->winpath_len = len; + aFaPath->winpathLPP_len = len + 4; aFaPath->winpath_file = 0; aFaPath->winmax_file_len = 0; - if (aFaPath->winpath[0] == L'\\' && - aFaPath->winpath[1] == L'\\' && - aFaPath->winpath[2] == L'?' && - aFaPath->winpath[3] == L'\\') - aFaPath->winpath2 = aFaPath->winpath + 4; - else - aFaPath->winpath2 = aFaPath->winpath; /* Convert to St specific form */ len = WideCharToMultiByte(CP_UTF8, @@ -222,6 +228,24 @@ int len; } + +/* + * faClearFile + * + * Remove the file off the current path, i.e. terminate the string + * where the directory name ends. + * + * aFaPath must have been initialised with faSetStDir prior to calling + * this function. + */ +void faClearFile(fapath *aFaPath) +{ + aFaPath->path[aFaPath->path_len] = 0; + aFaPath->winpath[aFaPath->winpath_len] = 0; +} + + + /* * faDbgDump * @@ -242,8 +266,8 @@ int i; } printf("\n"); printf("PlatPathLen: %d\n", aFaPath->winpath_len); - printf("Path: 0x%p, Path2: 0x%p, File: 0x%p\n", - (void *)aFaPath->winpath, (void *)aFaPath->winpath2, (void *)aFaPath->winpath_file); + printf("PathLPP: 0x%p, Path: 0x%p, File: 0x%p\n", + (void *)aFaPath->winpathLPP, (void *)aFaPath->winpath, (void *)aFaPath->winpath_file); printf("Max File Len: %d\n", aFaPath->winmax_file_len); printf("\n\n\n"); fflush(stdout); @@ -384,7 +408,7 @@ DWORD ffError; status = faSetStFile(aFaPath, "*"); if (status) return status; - aFaPath->directoryHandle = FindFirstFileW(faGetPlatPath(aFaPath), &aFaPath->findData); + aFaPath->directoryHandle = FindFirstFileW(faGetPlatPathLPP(aFaPath), &aFaPath->findData); if (aFaPath->directoryHandle == INVALID_HANDLE_VALUE) { ffError = GetLastError(); if (ffError == ERROR_NO_MORE_FILES) @@ -435,6 +459,30 @@ sqInt status; } + +/* + * faRewindDirectory + * + * Rewind the supplied directory and answer the first entry. + */ + +sqInt faRewindDirectory(fapath *aFaPath) +{ +sqInt status; + + /* + * Windows doesn't directly support rewind. + * Close and re-open the directory + */ + status = faCloseDirectory(aFaPath); + if (status) return status; + /* Remove any existing file from the path */ + faClearFile(aFaPath); + return faOpenDirectory(aFaPath); +} + + + /* * faFileAttribute * @@ -460,7 +508,7 @@ WIN32_FILE_ATTRIBUTE_DATA winAttrs; if (attributeNumber <= 8) { /* Requested attribute comes from stat() entry */ - status = _wstat(faGetPlatPath2(aFaPath), &statBuf); + status = _wstat(faGetPlatPath(aFaPath), &statBuf); if (status) return interpreterProxy->primitiveFailForOSError(FA_CANT_STAT_PATH); @@ -503,7 +551,7 @@ WIN32_FILE_ATTRIBUTE_DATA winAttrs; } } else if (attributeNumber <= 12) { - status = GetFileAttributesExW(faGetPlatPath2(aFaPath), + status = GetFileAttributesExW(faGetPlatPath(aFaPath), GetFileExInfoStandard, &winAttrs); if (!status) return interpreterProxy->primitiveFailForOSError(FA_CANT_STAT_PATH); @@ -553,13 +601,13 @@ WIN32_FILE_ATTRIBUTE_DATA winAttrs; mode = X_OK; break; } - if (_waccess(faGetPlatPath2(aFaPath), mode) == 0) + if (_waccess(faGetPlatPath(aFaPath), mode) == 0) resultOop = interpreterProxy->trueObject(); else resultOop = interpreterProxy->falseObject(); } else if (attributeNumber == 16) { /* isSymlink */ - status = GetFileAttributesExW(faGetPlatPath2(aFaPath), + status = GetFileAttributesExW(faGetPlatPath(aFaPath), GetFileExInfoStandard, &winAttrs); if (!status) return interpreterProxy->primitiveFailForOSError(FA_CANT_STAT_PATH); @@ -585,7 +633,7 @@ sqInt faStat(fapath *aFaPath, faStatStruct *statBuf, sqInt *fileNameOop) { int status; - status = _wstat(faGetPlatPath2(aFaPath), statBuf); + status = _wstat(faGetPlatPath(aFaPath), statBuf); if (status) return FA_CANT_STAT_PATH; fileNameOop[0] = interpreterProxy->nilObject(); return 0; @@ -616,7 +664,7 @@ sqInt faExists(fapath *aFaPath) { int status; - if (_waccess(faGetPlatPath2(aFaPath), F_OK)) + if (_waccess(faGetPlatPath(aFaPath), F_OK)) return interpreterProxy->falseObject(); else return interpreterProxy->trueObject(); @@ -642,13 +690,13 @@ sqInt accessOop; trueOop = interpreterProxy->trueObject(); falseOop = interpreterProxy->falseObject(); - accessOop = _waccess(faGetPlatPath2(aFaPath), R_OK) ? falseOop : trueOop; + accessOop = _waccess(faGetPlatPath(aFaPath), R_OK) ? falseOop : trueOop; interpreterProxy->storePointerofObjectwithValue(index++, attributeArray, accessOop); - accessOop = _waccess(faGetPlatPath2(aFaPath), W_OK) ? falseOop : trueOop; + accessOop = _waccess(faGetPlatPath(aFaPath), W_OK) ? falseOop : trueOop; interpreterProxy->storePointerofObjectwithValue(index++, attributeArray, accessOop); - accessOop = _waccess(faGetPlatPath2(aFaPath), X_OK) ? falseOop : trueOop; + accessOop = _waccess(faGetPlatPath(aFaPath), X_OK) ? falseOop : trueOop; interpreterProxy->storePointerofObjectwithValue(index++, attributeArray, accessOop); return 0; diff --git a/platforms/win32/plugins/FileAttributesPlugin/faSupport.h b/platforms/win32/plugins/FileAttributesPlugin/faSupport.h index 8001391f9f..3263ca4f3d 100644 --- a/platforms/win32/plugins/FileAttributesPlugin/faSupport.h +++ b/platforms/win32/plugins/FileAttributesPlugin/faSupport.h @@ -5,7 +5,7 @@ #include /* Maximum path length allowed on this platform */ -#define FA_PATH_MAX 4096 +#define FA_PATH_MAX 32768 #define PATH_SEPARATOR '\\' /* @@ -50,11 +50,11 @@ typedef struct fapathstruct { sqInt max_file_len; /* Add 4 bytes to winpath for the \\?\ prefix */ - WCHAR winpath[FA_PATH_MAX+4]; - sqInt winpath_len; /* Number of characters, including the prefix */ + WCHAR winpathLPP[FA_PATH_MAX+4]; + sqInt winpathLPP_len; /* Number of characters, including the prefix */ WCHAR *winpath_file; - WCHAR *winpath2; - sqInt winpath2_len; /* Number of characters, not bytes */ + WCHAR *winpath; + sqInt winpath_len; /* Number of characters, not bytes */ sqInt winmax_file_len; HANDLE directoryHandle; @@ -72,8 +72,8 @@ sqInt faSetPlatFile(fapath *aFaPath, WCHAR *pathName); #define faGetStFile(aFaPath) aFaPath->path_file #define faGetPlatPath(aFaPath) aFaPath->winpath #define faGetPlatPathByteCount(aFaPath) (aFaPath->winpath_len * sizeof(WCHAR)) -#define faGetPlatPath2(aFaPath) aFaPath->winpath2 -#define faGetPlatPath2ByteCount(aFaPath) (aFaPath->winpath2_len * sizeof(WCHAR)) +#define faGetPlatPathLPP(aFaPath) aFaPath->winpathLPP +#define faGetPlatPathLPPByteCount(aFaPath) (aFaPath->winpathLPP_len * sizeof(WCHAR)) #define faGetPlatFile(aFaPath) aFaPath->winpath_file sqInt faSetStDirOop(fapath *aFaPath, sqInt pathNameOop); @@ -82,6 +82,7 @@ sqInt faSetStPathOop(fapath *aFaPath, sqInt pathNameOop); sqInt faOpenDirectory(fapath *aFaPath); sqInt faReadDirectory(fapath *aFaPath); sqInt faCloseDirectory(fapath *aFaPath); +sqInt faRewindDirectory(fapath *aFaPath); sqInt faFileAttribute(fapath *aFaPath, sqInt attributeNumber); sqInt faStat(fapath *aFaPath, faStatStruct *statBuf, sqInt *fileNameOop); sqInt faLinkStat(fapath *aFaPath, faStatStruct *statBuf, sqInt *fileNameOop); diff --git a/src/plugins/FileAttributesPlugin/FileAttributesPlugin.c b/src/plugins/FileAttributesPlugin/FileAttributesPlugin.c index 6cb22b3bd0..6d7d7c6945 100644 --- a/src/plugins/FileAttributesPlugin/FileAttributesPlugin.c +++ b/src/plugins/FileAttributesPlugin/FileAttributesPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by VMPluginCodeGenerator VMMaker.oscog-eem.2445 uuid: ecf80f10-9e24-4ff5-8a41-d65cb2690c94 from - FileAttributesPlugin FileAttributesPlugin.oscog-AlistairGrant.38 uuid: f0fcdb0f-e642-4f87-8a9f-d35ffa0d05ff + FileAttributesPlugin * FileAttributesPlugin.oscog-AlistairGrant.38 uuid: f0fcdb0f-e642-4f87-8a9f-d35ffa0d05ff */ -static char __buildInfo[] = "FileAttributesPlugin FileAttributesPlugin.oscog-AlistairGrant.38 uuid: f0fcdb0f-e642-4f87-8a9f-d35ffa0d05ff " __DATE__ ; +static char __buildInfo[] = "FileAttributesPlugin * FileAttributesPlugin.oscog-AlistairGrant.38 uuid: f0fcdb0f-e642-4f87-8a9f-d35ffa0d05ff " __DATE__ ; @@ -96,7 +96,6 @@ EXPORT(sqInt) primitiveVersionString(void); static sqInt processDirectory(fapath *faPath); static sqInt readLinkintomaxLength(char *cPathName, char *cLinkPtr, size_t maxLength); EXPORT(sqInt) setInterpreter(struct VirtualMachine*anInterpreter); -static sqInt squeakPathtoPlatformmaxLen(sqInt pathOop, char *cPathString, sqInt maxLength); static sqInt statArrayFortoArrayfromfileName(fapath *faPath, sqInt attributeArray, faStatStruct *statBufPointer, sqInt fileNameOop); static sqInt stringFromCString(const char *aCString); #if _WIN32 @@ -177,9 +176,9 @@ extern struct VirtualMachine* interpreterProxy; static const char *moduleName = #ifdef SQUEAK_BUILTIN_PLUGIN - "FileAttributesPlugin FileAttributesPlugin.oscog-AlistairGrant.38 (i)" + "FileAttributesPlugin * FileAttributesPlugin.oscog-AlistairGrant.38 (i)" #else - "FileAttributesPlugin FileAttributesPlugin.oscog-AlistairGrant.38 (e)" + "FileAttributesPlugin * FileAttributesPlugin.oscog-AlistairGrant.38 (e)" #endif ; static void * sCLPfn; @@ -468,7 +467,7 @@ posixFileTimesFromto(faStatStruct *statBufPointer, sqInt attributeArray) EXPORT(sqInt) primitiveChangeMode(void) { - char cString[PATH_MAX+1]; + fapath *faPath; sqInt fileNameOop; sqInt newMode; sqInt status; @@ -481,11 +480,15 @@ primitiveChangeMode(void) } # if HAVE_CHMOD - squeakPathtoPlatformmaxLen(fileNameOop, cString, PATH_MAX); + faPath = (fapath *) calloc(1, sizeof(fapath)); + if (faPath == null) { + return primitiveFailForOSError(-10 /* cantAllocateMemory */); + } + faSetStPathOop(faPath, fileNameOop); if (failed()) { - return primitiveFailForOSError(primitiveFailureCode()); + return primitiveFailureCode(); } - status = chmod(cString, newMode); + status = chmod(faGetPlatPath(faPath), newMode); if (status != 0) { return primitiveFailForOSError(errno); } @@ -501,7 +504,7 @@ primitiveChangeMode(void) EXPORT(sqInt) primitiveChangeOwner(void) { - char cString[FA_PATH_MAX]; + fapath *faPath; sqInt fileNameOop; sqInt groupId; sqInt ownerId; @@ -516,11 +519,15 @@ primitiveChangeOwner(void) } # if HAVE_CHOWN - squeakPathtoPlatformmaxLen(fileNameOop, cString, FA_PATH_MAX); + faPath = (fapath *) calloc(1, sizeof(fapath)); + if (faPath == null) { + return primitiveFailForOSError(-10 /* cantAllocateMemory */); + } + faSetStPathOop(faPath, fileNameOop); if (failed()) { - return primitiveFailForOSError(primitiveFailureCode()); + return primitiveFailureCode(); } - status = chown(cString, ownerId, groupId); + status = chown(faGetPlatPath(faPath), ownerId, groupId); if (status != 0) { return primitiveFailForOSError(errno); } @@ -889,13 +896,23 @@ primitiveRewinddir(void) { sqInt dirPointerOop; fapath *faPath; + sqInt resultOop; + sqInt status; dirPointerOop = stackValue(0); faPath = pointerFrom(dirPointerOop); if (!(faPath)) { return primitiveFailFor(PrimErrBadArgument); } - return primitiveFailForOSError(-14 /* unexpectedError */); + status = faRewindDirectory(faPath); + if (status < 0) { + return primitiveFailForOSError(status); + } + resultOop = processDirectory(faPath); + if (failed()) { + return primitiveFailureCode(); + } + return methodReturnValue(resultOop); } @@ -941,7 +958,7 @@ primitiveStToPlatPath(void) EXPORT(sqInt) primitiveSymlinkChangeOwner(void) { - char cString[PATH_MAX+1]; + fapath *faPath; sqInt fileNameOop; sqInt groupId; sqInt ownerId; @@ -954,13 +971,17 @@ primitiveSymlinkChangeOwner(void) || (!(isBytes(fileNameOop)))) { return primitiveFailFor(PrimErrBadArgument); } - squeakPathtoPlatformmaxLen(fileNameOop, cString, PATH_MAX); - if (failed()) { - return primitiveFailForOSError(primitiveFailureCode()); - } # if HAVE_CHOWN - status = lchown(cString, ownerId, groupId); + faPath = (fapath *) calloc(1, sizeof(fapath)); + if (faPath == null) { + return primitiveFailForOSError(-10 /* cantAllocateMemory */); + } + faSetStPathOop(faPath, fileNameOop); + if (failed()) { + return primitiveFailureCode(); + } + status = lchown(faGetPlatPath(faPath), ownerId, groupId); if (status != 0) { return primitiveFailForOSError(errno); } @@ -976,10 +997,17 @@ primitiveSymlinkChangeOwner(void) EXPORT(sqInt) primitiveVersionString(void) { - popthenPush(1, stringFromCString("2.0.0")); + popthenPush(1, stringFromCString("2.0.1")); return 0; } + +/* The supplied faPath contains the full path to the current entry while + iterating over a directory. + Convert the file name to an object, get the attributes and answer the + resulting array. + */ + /* FileAttributesPlugin>>#processDirectory: */ static sqInt processDirectory(fapath *faPath) @@ -1101,45 +1129,6 @@ setInterpreter(struct VirtualMachine*anInterpreter) } -/* Convert the supplied path string oop to a unix c path string. - Parameter checking is done in the main primitive, so pathOop is assumed to - be valid. - pathOop is supplied as a precomposed UTF8 string. - cPathString must be encoded using the host OS conventions, e.g. decomposed - UTF8 on MacOS. - Signal primitive failure on error. - */ - - /* FileAttributesPlugin>>#squeakPath:toPlatform:maxLen: */ -static sqInt -squeakPathtoPlatformmaxLen(sqInt pathOop, char *cPathString, sqInt maxLength) -{ - int status; - char uxName[FA_PATH_MAX]; - - if (maxLength >= (FA_PATH_MAX)) { - return primitiveFailForOSError(-6 /* invalidArguments */); - } - -# if _WIN32 - status = pathOoptoBuffermaxLen(pathOop, cPathString, maxLength); - if (status != 0) { - return primitiveFailForOSError(status); - } -# else /* _WIN32 */ - status = pathOoptoBuffermaxLen(pathOop, uxName, PATH_MAX); - if (status != 0) { - return primitiveFailForOSError(status); - } - status = sq2uxPath(uxName, strlen(uxName), cPathString, maxLength, 1); - if (status == 0) { - return primitiveFailForOSError(-6 /* invalidArguments */); - } -# endif /* _WIN32 */ - return 0; -} - - /* Answer a file entry array from the supplied statBufPointer */ /* FileAttributesPlugin>>#statArrayFor:toArray:from:fileName: */ @@ -1273,7 +1262,7 @@ winFileTimesForto(fapath *faPath, sqInt attributeArray) /* Get the file attributes */ attributeDate = 0; - status = GetFileAttributesExW(faGetPlatPath2(faPath), GetFileExInfoStandard, &winAttrs); + status = GetFileAttributesExW(faGetPlatPath(faPath), GetFileExInfoStandard, &winAttrs); if (status == 0) { /* begin getAttributesFailed */ return -4; @@ -1305,8 +1294,8 @@ static char _m[] = "FileAttributesPlugin"; void* FileAttributesPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveChangeMode\000\001", (void*)primitiveChangeMode}, - {(void*)_m, "primitiveChangeOwner\000\001", (void*)primitiveChangeOwner}, + {(void*)_m, "primitiveChangeMode\000\000", (void*)primitiveChangeMode}, + {(void*)_m, "primitiveChangeOwner\000\000", (void*)primitiveChangeOwner}, {(void*)_m, "primitiveClosedir\000\001", (void*)primitiveClosedir}, {(void*)_m, "primitiveFileAttribute\000\000", (void*)primitiveFileAttribute}, {(void*)_m, "primitiveFileAttributes\000\001", (void*)primitiveFileAttributes}, @@ -1317,9 +1306,9 @@ void* FileAttributesPlugin_exports[][3] = { {(void*)_m, "primitivePathMax\000\377", (void*)primitivePathMax}, {(void*)_m, "primitivePlatToStPath\000\000", (void*)primitivePlatToStPath}, {(void*)_m, "primitiveReaddir\000\002", (void*)primitiveReaddir}, - {(void*)_m, "primitiveRewinddir\000\001", (void*)primitiveRewinddir}, + {(void*)_m, "primitiveRewinddir\000\002", (void*)primitiveRewinddir}, {(void*)_m, "primitiveStToPlatPath\000\000", (void*)primitiveStToPlatPath}, - {(void*)_m, "primitiveSymlinkChangeOwner\000\001", (void*)primitiveSymlinkChangeOwner}, + {(void*)_m, "primitiveSymlinkChangeOwner\000\000", (void*)primitiveSymlinkChangeOwner}, {(void*)_m, "primitiveVersionString\000\377", (void*)primitiveVersionString}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} @@ -1327,8 +1316,8 @@ void* FileAttributesPlugin_exports[][3] = { #else /* ifdef SQ_BUILTIN_PLUGIN */ -signed char primitiveChangeModeAccessorDepth = 1; -signed char primitiveChangeOwnerAccessorDepth = 1; +signed char primitiveChangeModeAccessorDepth = 0; +signed char primitiveChangeOwnerAccessorDepth = 0; signed char primitiveClosedirAccessorDepth = 1; signed char primitiveFileAttributeAccessorDepth = 0; signed char primitiveFileAttributesAccessorDepth = 1; @@ -1336,8 +1325,8 @@ signed char primitiveFileExistsAccessorDepth = 0; signed char primitiveOpendirAccessorDepth = 0; signed char primitivePlatToStPathAccessorDepth = 0; signed char primitiveReaddirAccessorDepth = 2; -signed char primitiveRewinddirAccessorDepth = 1; +signed char primitiveRewinddirAccessorDepth = 2; signed char primitiveStToPlatPathAccessorDepth = 0; -signed char primitiveSymlinkChangeOwnerAccessorDepth = 1; +signed char primitiveSymlinkChangeOwnerAccessorDepth = 0; #endif /* ifdef SQ_BUILTIN_PLUGIN */