Overview
| Artifact ID: | 9f3645621eb8282bac409b558ddef2c69d7a97e1 |
|---|---|
| Ticket: | 511658ffffffffffffffffffffffffffffffffff
'file attributes c:/' returns 'hidden 1' |
| User & Date: | vincentdarley on 2002-02-05 22:51:10 |
Changes
- icomment:
Logged In: YES user_id=32170 Using the following definition in tclWinFCmd.c should fix this: static int GetWinFileAttributes( Tcl_Interp *interp,/* The interp we are using for errors. */ int objIndex,/* The index of the attribute. */ Tcl_Obj *fileName, /* The name of the file. */ Tcl_Obj **attributePtrPtr)/* A pointer to return the object with. */ { DWORD result; CONST TCHAR *nativeName; int attr; nativeName = Tcl_FSGetNativePath(fileName); result = (*tclWinProcs->getFileAttributesProc) (nativeName); if (result == 0xffffffff) { StatError(interp, fileName); return TCL_ERROR; } attr = (int)(result & attributeArray[objIndex]); if ((objIndex == WIN_HIDDEN_ATTRIBUTE) && (attr != 0)) { /* * It is hidden. However there is a bug on some Windows * OSes in which root volumes (drives) formatted as NTFS * are declared hidden when they are not (and cannot be). * * We test for, and fix that case, here. */ int len; char *str = Tcl_GetStringFromObj(fileName,&len); if (len < 4) { if (len == 0) { /* * Not sure if this is possible, but we pass it on * anyway */ } else if (len == 1 && (str[0] == '/' || str[0] == '\\')) { /* Path is pointing to the root volume */ attr = 0; } else if ((str[1] == ':') && (len == 2 || (str [2] == '/' || str[2] == '\\'))) { /* Path is of the form 'x:' or 'x:/' or 'x:\' */ attr = 0; } } } *attributePtrPtr = Tcl_NewBooleanObj(attr); return TCL_OK; } - login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"