Skip to content

nob build fails on windows when called without file extension #29

Open
@OetkenPurveyorOfCode

Description

@OetkenPurveyorOfCode

Running nob without .exe file extension fails.

w:\musializer>nob build
[INFO] renaming nob -> nob.old
[ERROR] could not rename nob to nob.old: 2

The application takes its name from argv[0] which is nob and tries to rename a file name nob that does not exist. (Hint: The file name is nob.exe)

The build system should append the appropriate file extension to support being called without .exe.

One way to achieve this functionality would be:

    char pathbuf[MAX_PATH];
    GetModuleFileNameA(NULL, pathbuf, MAX_PATH);

To retrieve the binary path instead of using argv[0].

I think one should consider what should happen when the executable is called with a relative path.

w:\musializer>cd build
w:\musializer\build>..\nob.exe
[ERROR] Could not open file nob.c: 2

I think the build system could assume that nob.exe and nob.c are always in the same directory. To support calling the build system from a different working directory, the directory the binary lives in should be prepended to the file name of the source file to generate the full source file path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions