I'm trying to get a pre-build step to check to see if a file exists, to that end I have:
[[ if ( !exist( "svnversion.h" ) ) { printl( "Hello" ); } ]]
But I get an error stating "the index 'exist' does not exist".
Can someone please point out what I'm doing wrong?
Thank you!
I tried using the 'file' command:
[[ local svnfile = file("svnversion.h", "r"); if ( !svnfile ) { printl( "Hello" ); } ]]
But also received an error: "the index 'file' does not exist"
Yet, as I understand it, it should have worked (at least attempted to read the file):
http://squirrel-lang.org/doc/sqstdlib2.html#d0e159 (http://squirrel-lang.org/doc/sqstdlib2.html#d0e159)
I've got it to work:
[[ local svnfile = _T("svnversion.h"); local svncmd = _T("cmd /c svn info --revision HEAD | grep Revision | sed -f svnversion.sed > svnversion.h"); if ( !IO.FileExists(svnfile) ) { IO.Execute(svncmd); } ]]
My question is, is IO.Execute the best way to make a system call?
My question is, is IO.Execute the best way to make a system call?
Yes. Notice the C::B script security must be configured correctly to allow (system) IO calls.
Agreed... I had to allow the script to launch executables
Is it possible to have the Pre-build step call a script? I tried with:
[[ Include(_T("svnversion.script")); GenerateSvnVersion(); ]]
Where svnversion.script contained the GenerateSvnVersion() function. It gave me an error when I tried this implementation.