diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinFCmd.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index 89cb59f..fd5cd5d 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFCmd.c,v 1.62 2010/04/22 11:40:32 nijtmans Exp $ + * RCS: @(#) $Id: tclWinFCmd.c,v 1.63 2010/08/14 17:13:02 nijtmans Exp $ */ #include "tclWinInt.h" @@ -766,34 +766,35 @@ TclpObjDeleteFile( int TclpDeleteFile( - const TCHAR *nativePath) /* Pathname of file to be removed (native). */ + const void *nativePath) /* Pathname of file to be removed (native). */ { DWORD attr; + const TCHAR *path = nativePath; /* * The DeleteFile API acts differently under Win95/98 and NT WRT NULL and * "". Avoid passing these values. */ - if (nativePath == NULL || nativePath[0] == '\0') { + if (path == NULL || path[0] == '\0') { Tcl_SetErrno(ENOENT); return TCL_ERROR; } - if (tclWinProcs->deleteFileProc(nativePath) != FALSE) { + if (tclWinProcs->deleteFileProc(path) != FALSE) { return TCL_OK; } TclWinConvertError(GetLastError()); if (Tcl_GetErrno() == EACCES) { - attr = tclWinProcs->getFileAttributesProc(nativePath); + attr = tclWinProcs->getFileAttributesProc(path); if (attr != 0xffffffff) { if (attr & FILE_ATTRIBUTE_DIRECTORY) { if (attr & FILE_ATTRIBUTE_REPARSE_POINT) { /* * It is a symbolic link - remove it. */ - if (TclWinSymLinkDelete(nativePath, 0) == 0) { + if (TclWinSymLinkDelete(path, 0) == 0) { return TCL_OK; } } @@ -807,21 +808,21 @@ TclpDeleteFile( Tcl_SetErrno(EISDIR); } else if (attr & FILE_ATTRIBUTE_READONLY) { - int res = tclWinProcs->setFileAttributesProc(nativePath, + int res = tclWinProcs->setFileAttributesProc(path, attr & ~((DWORD) FILE_ATTRIBUTE_READONLY)); if ((res != 0) && - (tclWinProcs->deleteFileProc(nativePath) != FALSE)) { + (tclWinProcs->deleteFileProc(path) != FALSE)) { return TCL_OK; } TclWinConvertError(GetLastError()); if (res != 0) { - tclWinProcs->setFileAttributesProc(nativePath, attr); + tclWinProcs->setFileAttributesProc(path, attr); } } } } else if (Tcl_GetErrno() == ENOENT) { - attr = tclWinProcs->getFileAttributesProc(nativePath); + attr = tclWinProcs->getFileAttributesProc(path); if (attr != 0xffffffff) { if (attr & FILE_ATTRIBUTE_DIRECTORY) { /* |