User forums > Using Code::Blocks

Pre-build Squirrel scripting question

(1/2) > >>

ironhead:
I'm trying to get a pre-build step to check to see if a file exists, to that end I have:


--- Code: ---[[ if ( !exist( "svnversion.h" ) ) { printl( "Hello" ); } ]]
--- End code ---

But I get an error stating "the index 'exist' does not exist".

Can someone please point out what I'm doing wrong?

Thank you!

MortenMacFly:

--- Quote from: ironhead on December 01, 2009, 04:25:25 pm ---Can someone please point out what I'm doing wrong?

--- End quote ---
"exist" and "printl" are not valid Squirrel script functions. They are not even C++ btw...

ironhead:

--- Quote from: MortenMacFly on December 01, 2009, 05:14:09 pm ---"exist" and "printl" are not valid Squirrel script functions. They are not even C++ btw...

--- End quote ---

Hrmm...  interesting, I got 'exist' and 'printl' from:

http://www.ibm.com/developerworks/aix/library/au-spunix_squirrel/index.html

Is there definitive guide as to what functions are provided in the version of squirrel used by C::B?

ironhead:
I tried using the 'file' command:


--- Code: ---[[ local svnfile = file("svnversion.h", "r"); if ( !svnfile ) { printl( "Hello" ); } ]]
--- End code ---

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

ironhead:
I've got it to work:


--- Code: ---[[ 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); } ]]
--- End code ---

My question is, is IO.Execute the best way to make a system call?

Navigation

[0] Message Index

[#] Next page

Go to full version