Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 28, 2025

The existing Dmod_ReadDir only returns entry names. Need type information (file vs directory) similar to POSIX dirent.

Changes

  • New types (dmod_types.h):

    • Dmod_DirEntryType_t: enum for Unknown, File, Dir, Link, Other
    • Dmod_DirEntry_t: struct with name and type fields
  • New API (dmod_sal.h, dmod_if_file.c):

    • Dmod_ReadDirEx() returns const Dmod_DirEntry_t* with type detection via d_type
    • Static storage semantics match POSIX readdir() (not thread-safe across calls)
    • Degrades gracefully to Unknown type on platforms without d_type support
  • Tests (tests_dmod_dir.cpp):

    • Type detection, end-of-directory handling, backward compatibility validation
    • All existing Dmod_ReadDir tests remain passing

Example

void* dir = Dmod_OpenDir(".");
const Dmod_DirEntry_t* entry;
while ((entry = Dmod_ReadDirEx(dir)) != NULL) {
    if (entry->type == Dmod_DirEntryType_Dir) {
        // Handle directory
    }
}
Dmod_CloseDir(dir);

// Original API still works unchanged
const char* name;
while ((name = Dmod_ReadDir(dir)) != NULL) { ... }

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Dodać Dmod_ReadDirEx, który zwraca więcej informacji</issue_title>
<issue_description>Aktualnie Dmod_ReadDir zwraca tylko nazwę pliku/katalogu, a przydaje się trochę więcej info - np czy to katalog czy plik. Potrzebujemy zatem dodatkowego interfejsu, może czegoś podobnego do dirent? Musimy być kompatybilni wstecz, więc niech Dmod_ReadDir zostanie jak był, ale dodajmy ten nowy interfejs obok</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits December 28, 2025 21:28
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Dmod_ReadDirEx to return more file information Add Dmod_ReadDirEx for directory entries with type information Dec 28, 2025
Copilot AI requested a review from JohnAmadis December 28, 2025 21:39
@JohnAmadis JohnAmadis marked this pull request as ready for review December 28, 2025 22:19
@JohnAmadis JohnAmadis merged commit 08404b3 into develop Dec 28, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dodać Dmod_ReadDirEx, który zwraca więcej informacji

2 participants