Author Topic: buildnumber in filename  (Read 3807 times)

Offline hollim

  • Single posting newcomer
  • *
  • Posts: 2
buildnumber in filename
« on: May 28, 2014, 10:32:33 am »
Hi forum,

an output file in a Release target need to be named including the actual build number. Fortunately the build number is stored in a separate file inside the project dir. The manual says that back ticks could be used. So a command line in the targets' post script like the following should do it in my opinion:
Code
objdump -D $(TARGET_OUTPUT_FILE) > $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)-`type buildnumber.dat`.dump
This unfortunately doesn't work.
The manual however doesn't tell, if this is either platform dependent or to be used in a special context only.
This problem arose on a Windows 7 VM using C::B 13.12.

Can anybody give a hint, please?

Greetings
Hollim

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: buildnumber in filename
« Reply #1 on: May 29, 2014, 12:08:44 am »
Are you sure there is no new line character at the end of the buildnumber.dat file?
Are you sure type is not printing one for you?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline hollim

  • Single posting newcomer
  • *
  • Posts: 2
Re: buildnumber in filename
« Reply #2 on: May 29, 2014, 09:59:14 pm »
There is a 0x0d 0x0a in the file (it's Window$).
I'm sure 'type' isn't able to do anything as it doesn't gets called at all.

Putting a line with:
Code
`find "blablabla" c:\temp\usercode.txt`
in a post build script, its execution results in:
Code
Running target post-build steps
`find "blablabla" c:\temp\usercode.txt`
Execution of '`find "blablabla" c:\temp\usercode.txt`' in 'C:\Pro\newproject' failed.
It does however run fine in a regular cmd window.

Ho did you implement the back ticks in the Win version of C::B? Are you sure this is available on Win?

If this isn't working, is there a way to set a (global) variable from a pre build script for using in the post build script?

Please note that I'm not aware of the C::B script engine - I'm talking about the Project Build Options / Pre/Post Build Steps.

Thanks.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: buildnumber in filename
« Reply #3 on: May 29, 2014, 10:46:38 pm »
Hm, probably type is not an executable, but a build-in command of cmd.exe.

But I've tried `echo 5` and it is not executed. Probably C::B is not doing the macro expansion on the executables output... Someone needs to check the source to verify if this is the case...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]