When deleting a file, if it fails with "Access is denied" then set the file
attributes to normal and try again. Some files in the .git directory are set to read-only, preventing the build machines from deleting old builds.db4
parent
1f105209cf
commit
5608178389
|
@ -19,8 +19,21 @@ M: windows move-file ( from to -- )
|
||||||
|
|
||||||
ERROR: file-delete-failed path error ;
|
ERROR: file-delete-failed path error ;
|
||||||
|
|
||||||
|
: delete-file-throws ( path -- )
|
||||||
|
DeleteFile win32-error=0/f ;
|
||||||
|
|
||||||
|
: delete-read-only-file ( path -- )
|
||||||
|
[ set-file-normal-attribute ] [ delete-file-throws ] bi ;
|
||||||
|
|
||||||
|
: (delete-file) ( path -- )
|
||||||
|
dup DeleteFile 0 = [
|
||||||
|
GetLastError ERROR_ACCESS_DENIED =
|
||||||
|
[ delete-read-only-file ] [ win32-error ] if
|
||||||
|
] [ drop ] if ;
|
||||||
|
|
||||||
M: windows delete-file ( path -- )
|
M: windows delete-file ( path -- )
|
||||||
[ normalize-path DeleteFile win32-error=0/f ]
|
normalize-path
|
||||||
|
[ (delete-file) ]
|
||||||
[ \ file-delete-failed boa rethrow ] recover ;
|
[ \ file-delete-failed boa rethrow ] recover ;
|
||||||
|
|
||||||
M: windows copy-file ( from to -- )
|
M: windows copy-file ( from to -- )
|
||||||
|
|
|
@ -281,6 +281,15 @@ SYMBOLS: +read-only+ +hidden+ +system+
|
||||||
+sparse-file+ +reparse-point+ +compressed+ +offline+
|
+sparse-file+ +reparse-point+ +compressed+ +offline+
|
||||||
+not-content-indexed+ +encrypted+ ;
|
+not-content-indexed+ +encrypted+ ;
|
||||||
|
|
||||||
|
: read-only? ( file-info -- ? )
|
||||||
|
attributes>> +read-only+ swap member? ;
|
||||||
|
|
||||||
|
: set-file-attributes ( path flags -- )
|
||||||
|
SetFileAttributes win32-error=0/f ;
|
||||||
|
|
||||||
|
: set-file-normal-attribute ( path -- )
|
||||||
|
FILE_ATTRIBUTE_NORMAL set-file-attributes ;
|
||||||
|
|
||||||
: win32-file-attribute ( n symbol attr -- )
|
: win32-file-attribute ( n symbol attr -- )
|
||||||
rot mask? [ , ] [ drop ] if ;
|
rot mask? [ , ] [ drop ] if ;
|
||||||
|
|
||||||
|
|
|
@ -1770,7 +1770,8 @@ ALIAS: SetEnvironmentVariable SetEnvironmentVariableW
|
||||||
! FUNCTION: SetFileApisToANSI
|
! FUNCTION: SetFileApisToANSI
|
||||||
! FUNCTION: SetFileApisToOEM
|
! FUNCTION: SetFileApisToOEM
|
||||||
! FUNCTION: SetFileAttributesA
|
! FUNCTION: SetFileAttributesA
|
||||||
! FUNCTION: SetFileAttributesW
|
FUNCTION: BOOL SetFileAttributesW ( LPCTSTR lpFileName, DWORD dwFileAttributes ) ;
|
||||||
|
ALIAS: SetFileAttributes SetFileAttributesW
|
||||||
FUNCTION: DWORD SetFilePointer ( HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod ) ;
|
FUNCTION: DWORD SetFilePointer ( HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod ) ;
|
||||||
FUNCTION: DWORD SetFilePointerEx ( HANDLE hFile, LARGE_INTEGER lDistanceToMove, PLARGE_INTEGER lpDistanceToMoveHigh, DWORD dwMoveMethod ) ;
|
FUNCTION: DWORD SetFilePointerEx ( HANDLE hFile, LARGE_INTEGER lDistanceToMove, PLARGE_INTEGER lpDistanceToMoveHigh, DWORD dwMoveMethod ) ;
|
||||||
! FUNCTION: SetFileShortNameA
|
! FUNCTION: SetFileShortNameA
|
||||||
|
|
Loading…
Reference in New Issue