SiegeLord / DAllegro5

D binding to the Allegro5 game development library
Other
42 stars 15 forks source link

create_import_libs.bat should guard against dirs with spaces/hyphens #43

Closed SimonN closed 6 years ago

SimonN commented 6 years ago

The .dll->.lib Windows batch file from 2011 is still in use, it reads as follows:

@echo off
for %%a in (*.dll) do (
    for /f "tokens=1 delims=-" %%i in ("%%~DPNa") do (
        implib /s %%i %%~DPNa.dll
    )
)

Forestidia reported on Lemmings Forums:

It looks like the directory path shouldn't have something like spaces or hyphens ("-") for the batch file to work properly.

SimonN commented 6 years ago

Example of bug when the path has a hyphen:

Create directory C:/some/directory/test-5/ and put the Allegro DLLs, e.g., allegro-5.2.dll, and implib.exe into this directory. Run the batch file (as given in the original post) in this directory.

Expected: Get file C:/some/directory/test-5/allegro.lib. Observed: Get file C:/some/directory/test.lib.

I'm merely forwarding this description of the bug. I don't know how to write Windows batch files and I don't have a machine to test. For now, I'll document this bug #43 in my build notes that tell people how to install Allegro 5 into a Windows D toolchain.

SiegeLord commented 6 years ago

This wasn't too bad to fix, surprisingly.