@@ -242,8 +242,8 @@ private static bool IsDirectory(string path)
242242
243243 private static void OnCreated ( object sender , FileSystemEventArgs e , FileCache cache , FileCacheEntry entry )
244244 {
245- var key = e . FullPath . Replace ( entry . _path , entry . _prefix ) ;
246- var file = e . FullPath ;
245+ var key = e . FullPath . Replace ( ' \\ ' , '/' ) . Replace ( entry . _path + "/" , entry . _prefix ) ;
246+ var file = e . FullPath . Replace ( ' \\ ' , '/' ) ;
247247
248248 // Skip missing files
249249 if ( ! File . Exists ( file ) )
@@ -260,8 +260,8 @@ private static void OnChanged(object sender, FileSystemEventArgs e, FileCache ca
260260 if ( e . ChangeType != WatcherChangeTypes . Changed )
261261 return ;
262262
263- var key = e . FullPath . Replace ( entry . _path , entry . _prefix ) ;
264- var file = e . FullPath ;
263+ var key = e . FullPath . Replace ( ' \\ ' , '/' ) . Replace ( entry . _path + "/" , entry . _prefix ) ;
264+ var file = e . FullPath . Replace ( ' \\ ' , '/' ) ;
265265
266266 // Skip missing files
267267 if ( ! File . Exists ( file ) )
@@ -275,18 +275,18 @@ private static void OnChanged(object sender, FileSystemEventArgs e, FileCache ca
275275
276276 private static void OnDeleted ( object sender , FileSystemEventArgs e , FileCache cache , FileCacheEntry entry )
277277 {
278- var key = e . FullPath . Replace ( entry . _path , entry . _prefix ) ;
279- var file = e . FullPath ;
278+ var key = e . FullPath . Replace ( ' \\ ' , '/' ) . Replace ( entry . _path + "/" , entry . _prefix ) ;
279+ var file = e . FullPath . Replace ( ' \\ ' , '/' ) ;
280280
281281 cache . RemoveFileInternal ( entry . _path , key ) ;
282282 }
283283
284284 private static void OnRenamed ( object sender , RenamedEventArgs e , FileCache cache , FileCacheEntry entry )
285285 {
286- var oldKey = e . OldFullPath . Replace ( entry . _path , entry . _prefix ) ;
287- var oldFile = e . OldFullPath ;
288- var newKey = e . FullPath . Replace ( entry . _path , entry . _prefix ) ;
289- var newFile = e . FullPath ;
286+ var oldKey = e . OldFullPath . Replace ( ' \\ ' , '/' ) . Replace ( entry . _path + "/" , entry . _prefix ) ;
287+ var oldFile = e . OldFullPath . Replace ( ' \\ ' , '/' ) ;
288+ var newKey = e . FullPath . Replace ( ' \\ ' , '/' ) . Replace ( entry . _path + "/" , entry . _prefix ) ;
289+ var newFile = e . FullPath . Replace ( ' \\ ' , '/' ) ;
290290
291291 // Skip missing files
292292 if ( ! File . Exists ( newFile ) )
@@ -304,9 +304,6 @@ private bool InsertFileInternal(string path, string file, string key, TimeSpan t
304304 {
305305 try
306306 {
307- key = key . Replace ( '\\ ' , '/' ) ;
308- file = file . Replace ( '\\ ' , '/' ) ;
309-
310307 // Load the cache file content
311308 var content = File . ReadAllBytes ( file ) ;
312309 if ( ! handler ( this , key , content , timeout ) )
@@ -327,8 +324,6 @@ private bool RemoveFileInternal(string path, string key)
327324 {
328325 try
329326 {
330- key = key . Replace ( '\\ ' , '/' ) ;
331-
332327 using ( new WriteLock ( _lockEx ) )
333328 {
334329 // Update entries by path map
0 commit comments