graphitemaster / incbin

Include binary files in C/C++
The Unlicense
966 stars 90 forks source link

-I causes the incbin tool to hiccup #21

Closed IngwiePhoenix closed 7 years ago

IngwiePhoenix commented 8 years ago

Hey.

I was writing a script to automate use of Incbin on Windows - and also to test what I can do with IncBin from a script - and came across this:

Ingwie@Ingwies-Macbook-Pro.local ~/W/IceTea $ ./out/incbin -o test.c ./out/icetea-scripts.incbin.h
included `./out/icetea-scripts.incbin.h'
generated `test.c'
Ingwie@Ingwies-Macbook-Pro.local ~/W/IceTea $ ./out/incbin -o test.c (pwd)/out/icetea-scripts.incbin.h
included `/Users/Ingwie/Work/IceTea/out/icetea-scripts.incbin.h'
generated `test.c'
Ingwie@Ingwies-Macbook-Pro.local ~/W/IceTea $ ./out/incbin -I. -o test.c (pwd)/out/icetea-scripts.incbin.h
failed to open `/Users/Ingwie/Work/IceTea/out/icetea-scripts.incbin.h' for reading
Ingwie@Ingwies-Macbook-Pro.local ~/W/IceTea $ ./out/incbin -I . -o test.c (pwd)/out/icetea-scripts.incbin.h
included `.'
failed to include data `lib/std.os'
included `/Users/Ingwie/Work/IceTea/out/icetea-scripts.incbin.h'
generated `test.c'

-I. causes an error, whilst -I . does not let me see my files.

I am not depending on -I for now, but it might be good to look into this. :)

graphitemaster commented 8 years ago

You should not have to supply the current working directory for it to find your files. It's implicit. The help documentation shows clearly that the correct form of -I is without a space character. I don't see the problem.

IngwiePhoenix commented 8 years ago

Turns out you are right. But why doesn't this work, then?

Ingwie@Ingwies-MBP.Speedport_W723_V_Typ_A_1_01_012 ~/W/IceTea $ ./out/incbin -I. -o out.c out/icetea-scripts.incbin.h
included `out/icetea-scripts.incbin.h'
generated `out.c'
Ingwie@Ingwies-MBP.Speedport_W723_V_Typ_A_1_01_012 ~/W/IceTea $ mkdir t
Ingwie@Ingwies-MBP.Speedport_W723_V_Typ_A_1_01_012 ~/W/IceTea $ cd t
Ingwie@Ingwies-MBP.Speedport_W723_V_Typ_A_1_01_012 ~/W/I/t $ ../out/incbin -I.. -o out.c ../out/icetea-scripts.incbin.h
failed to open `../out/icetea-scripts.incbin.h' for reading
Ingwie@Ingwies-MBP.Speedport_W723_V_Typ_A_1_01_012 ~/W/I/t $ file ../out/icetea-scripts.incbin.h
../out/icetea-scripts.incbin.h: ASCII c program text
graphitemaster commented 8 years ago

Because path names require a space after the -I, so -I ..

graphitemaster commented 7 years ago

Not an issue, just tested again, the command line was used wrong in your example