Skip to content

Commit 598af7a

Browse files
authored
Merge pull request #1461 from Unity-Technologies/unity-master-fix-1344552
Make FileSystemEventArgs.Name relative (case 1344552)
2 parents 41c1733 + 03d8ec1 commit 598af7a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mcs/class/System/System.IO/DefaultWatcher.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ void IterateAndModifyFilesData (DefaultWatcherData data, string directory, bool
249249
}
250250

251251
if (dispatch)
252-
DispatchEvents (data.FSW, FileAction.Added, filename);
252+
DispatchEvents (data.FSW, FileAction.Added, Path.GetRelativePath(directory, filename));
253253
} else if (fd.Directory == directory) {
254254
fd.NotExists = false;
255255
}
@@ -268,7 +268,7 @@ void IterateAndModifyFilesData (DefaultWatcherData data, string directory, bool
268268
removed = new List<string> ();
269269

270270
removed.Add (filename);
271-
DispatchEvents (data.FSW, FileAction.Removed, filename);
271+
DispatchEvents (data.FSW, FileAction.Removed, Path.GetRelativePath(fd.Directory, filename));
272272
}
273273
}
274274

@@ -293,14 +293,14 @@ void IterateAndModifyFilesData (DefaultWatcherData data, string directory, bool
293293
removed = new List<string> ();
294294

295295
removed.Add (filename);
296-
DispatchEvents (data.FSW, FileAction.Removed, filename);
296+
DispatchEvents (data.FSW, FileAction.Removed, Path.GetRelativePath(fd.Directory, filename));
297297
continue;
298298
}
299299

300300
if (creation != fd.CreationTime || write != fd.LastWriteTime) {
301301
fd.CreationTime = creation;
302302
fd.LastWriteTime = write;
303-
DispatchEvents (data.FSW, FileAction.Modified, filename);
303+
DispatchEvents (data.FSW, FileAction.Modified, Path.GetRelativePath(fd.Directory, filename));
304304
}
305305
}
306306

0 commit comments

Comments
 (0)