Skip to content
This repository was archived by the owner on Apr 14, 2025. It is now read-only.

Commit 1d55129

Browse files
authored
Merge pull request #28 from boriel-basic/fix/bug-24-FileExplorer
Fix/bug 24 file explorer
2 parents 655cbc4 + 2d7f814 commit 1d55129

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

ZXBStudio/Controls/ZXProjectExplorer.axaml.cs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ public void UpdateProjectFolder()
183183
{
184184
fWatcher.Created -= FWatcher_Created;
185185
fWatcher.Deleted -= FWatcher_Deleted;
186+
fWatcher.Renamed -= FWatcher_Renamed;
186187
fWatcher.EnableRaisingEvents = false;
187188
fWatcher.Dispose();
188189
}
@@ -238,8 +239,15 @@ private void FWatcher_Renamed(object sender, RenamedEventArgs e)
238239
else
239240
{
240241
var parent = FindNode(pathWithoutNode, _nodes);
241-
if (parent != null)
242+
if (parent == null)
243+
{
244+
UpdateProjectFolder();
245+
return;
246+
}
247+
else
248+
{
242249
container = parent.ChildNodes;
250+
}
243251
}
244252

245253
if (container != null)
@@ -364,8 +372,15 @@ private void FWatcher_Deleted(object sender, FileSystemEventArgs e)
364372
else
365373
{
366374
var parent = FindNode(pathWithoutNode, _nodes);
367-
if (parent != null)
375+
if (parent == null)
376+
{
377+
UpdateProjectFolder();
378+
return;
379+
}
380+
else
381+
{
368382
container = parent.ChildNodes;
383+
}
369384
}
370385

371386
//Not found? ingnore...
@@ -404,8 +419,15 @@ private void FWatcher_Created(object sender, FileSystemEventArgs e)
404419
else
405420
{
406421
var node = FindNode(pathWithoutNode, _nodes);
407-
if (node != null)
422+
if (node == null)
423+
{
424+
UpdateProjectFolder();
425+
return;
426+
}
427+
else
428+
{
408429
container = node.ChildNodes;
430+
}
409431
}
410432

411433
//We didn't found where to add it... :(

0 commit comments

Comments
 (0)