@@ -79,7 +79,7 @@ void tests(FileUtils utils, FileSystem fs) {
79
79
expect (
80
80
() => fileSystem.removeFile (path),
81
81
throwsA (
82
- isA <PathAccessException >().having (
82
+ isA <IOFileException >().having (
83
83
(e) => e.errorCode,
84
84
'errorCode' ,
85
85
fileSystem is WindowsFileSystem
@@ -99,10 +99,29 @@ void tests(FileUtils utils, FileSystem fs) {
99
99
utils.createDirectory (dirPath);
100
100
io.Link (linkPath).createSync (dirPath);
101
101
102
- fileSystem.removeFile (linkPath);
103
-
104
- expect (utils.exists (dirPath), isTrue, reason: '$dirPath does not exist' );
105
- expect (utils.exists (linkPath), isFalse, reason: '$linkPath exists' );
102
+ if (fs is WindowsFileSystem ) {
103
+ expect (
104
+ () => fileSystem.removeFile (linkPath),
105
+ throwsA (
106
+ isA <PathAccessException >().having (
107
+ (e) => e.errorCode,
108
+ 'errorCode' ,
109
+ win32.ERROR_ACCESS_DENIED ,
110
+ ),
111
+ ),
112
+ );
113
+ expect (utils.exists (dirPath), isTrue, reason: '$dirPath does not exist' );
114
+ expect (
115
+ utils.exists (linkPath),
116
+ isTrue,
117
+ reason: '$linkPath does not exist' ,
118
+ );
119
+ } else {
120
+ fileSystem.removeFile (linkPath);
121
+
122
+ expect (utils.exists (dirPath), isTrue, reason: '$dirPath does not exist' );
123
+ expect (utils.exists (linkPath), isFalse, reason: '$linkPath exists' );
124
+ }
106
125
});
107
126
108
127
test ('link to file' , () {
0 commit comments