From 94df8ef1766386b9bc7f9727ffb728e4b1e9bbd8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 17:18:25 +0000 Subject: [PATCH 1/3] Initial plan From 9670969c59eaf82743427687e790a4f2cae05cab Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 17:21:04 +0000 Subject: [PATCH 2/3] Fix is_file() to properly distinguish files from directories Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com> --- src/dmdevfs.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/dmdevfs.c b/src/dmdevfs.c index 27e88ab..72f6a67 100644 --- a/src/dmdevfs.c +++ b/src/dmdevfs.c @@ -964,7 +964,21 @@ static int unconfigure_drivers(dmfsi_context_t ctx) */ static bool is_file(const char* path) { - return Dmod_Access(path, DMOD_F_OK) == 0; + // Check if path exists + if (Dmod_Access(path, DMOD_F_OK) != 0) + { + return false; + } + + // Try to open as directory - if it succeeds, it's a directory, not a file + void* dir = Dmod_OpenDir(path); + if (dir != NULL) + { + Dmod_CloseDir(dir); + return false; // It's a directory + } + + return true; // It's a file } /** From 3c3006e428db221d8b9da24b9a8a9916ed68baba Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 17:21:33 +0000 Subject: [PATCH 3/3] Improve variable naming in is_file() function Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com> --- src/dmdevfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dmdevfs.c b/src/dmdevfs.c index 72f6a67..a754836 100644 --- a/src/dmdevfs.c +++ b/src/dmdevfs.c @@ -971,10 +971,10 @@ static bool is_file(const char* path) } // Try to open as directory - if it succeeds, it's a directory, not a file - void* dir = Dmod_OpenDir(path); - if (dir != NULL) + void* dir_handle = Dmod_OpenDir(path); + if (dir_handle != NULL) { - Dmod_CloseDir(dir); + Dmod_CloseDir(dir_handle); return false; // It's a directory }