Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

Configuration loading failed when /configs/dmclk was a directory containing INI files. The system attempted to parse the directory itself as an INI file, producing errors.

Root Cause

is_file() used Dmod_Access(path, DMOD_F_OK) which only checks existence, returning true for both files and directories.

Changes

  • Modified is_file() to attempt opening the path as a directory
  • Returns false if Dmod_OpenDir() succeeds (it's a directory)
  • Returns true otherwise (it's a file)
static bool is_file(const char* path)
{
    if (Dmod_Access(path, DMOD_F_OK) != 0)
        return false;
    
    void* dir_handle = Dmod_OpenDir(path);
    if (dir_handle != NULL)
    {
        Dmod_CloseDir(dir_handle);
        return false;  // It's a directory
    }
    
    return true;  // It's a file
}

This enables configure_drivers() to correctly recurse into configuration subdirectories and process INI files within them.

Original prompt

This section details on the original issue you should resolve

<issue_title>dmclk nie może być skonfigurowany przez niepoprawne szukanie plików konfiguracyjnych</issue_title>
<issue_description>Oto logi:

[INFO] Connecting API from dmell to dmdevfs
[INFO] Connecting API from dmramfs to dmdevfs
[INFO] Connecting API from dmffs to dmdevfs
[INFO] Connecting API from dmini to dmdevfs
[INFO] Connecting API from dmdevfs to dmell
[INFO] Connecting API from dmdevfs to dmramfs
[INFO] Connecting API from dmdevfs to dmffs
[INFO] Connecting API from dmdevfs to dmdevfs
[INFO] Connecting API from dmdevfs to dmini
[INFO] Module enabled: dmdevfs
[INFO] dmlist: Created list for module dmdevfs.
[INFO] Directory '/configs' opened successfully
[ERROR] Failed to open file '/configs/dmclk'
dmdevfs: [ERROR] Failed to parse INI file: /configs/dmclk
dmdevfs: [ERROR] Failed to read driver for config: /configs/dmclk
[INFO] Directory closed successfully
[INFO] File system 'dmdevfs' mounted at '/dev' successfully
[INFO] No startup.dmp embedded in ROM
DMOD-Boot started
stm32f746xg@/> ls /configs/dmclk
[WARN] Could not create mutex
stm32f746g-disco.ini  
[WARN] dmheap: Module Invalid is not registered.

```</issue_description>

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

<comments>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 10, 2026 17:21
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
@JohnAmadis JohnAmadis marked this pull request as ready for review February 10, 2026 17:23
Copilot AI changed the title [WIP] Fix dmclk configuration issue due to incorrect file searching Fix is_file() to distinguish directories from files Feb 10, 2026
Copilot AI requested a review from JohnAmadis February 10, 2026 17:23
@JohnAmadis JohnAmadis merged commit 15af9a1 into main Feb 10, 2026
1 check 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.

dmclk nie może być skonfigurowany przez niepoprawne szukanie plików konfiguracyjnych

2 participants