Skip to content

Support filename wildcards on windows commandline (*.dll) #85

@jaromil

Description

@jaromil

Wildcards, such as * and ?, don't work directly with standard C functions like fopen(3) or open(3) on Windows because the C standard library functions don't expand wildcards into lists of filenames.

To process wildcards we need to use the Windows API, specifically functions like FindFirstFile and FindNextFile.

Example:

#include <windows.h>
#include <stdio.h>

int main() {
    WIN32_FIND_DATA findFileData;
    HANDLE hFind = FindFirstFile("*.txt", &findFileData);

    if (hFind == INVALID_HANDLE_VALUE) {
        printf("No files found.\n");
        return 1;
    } else {
        do {
            printf("Found file: %s\n", findFileData.cFileName);
        } while (FindNextFile(hFind, &findFileData) != 0);

        FindClose(hFind);
    }

    return 0;
}

Such a parsing logic should go into a function in src/file.c then called by src/cjit.c to parse arguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions