The code below will obtain the filename of the application executable file.
Is there any way to obtain the filename of the source file that is being compiled?
#if DebugBuild then
Dim f as FolderItem
Dim appIDEFileName as String
f = App.ExecutableFile
appIDEFileName = f.NativePath
Excellent. This is exactly the kind of thing I was looking for. Now the problem is getting it to work right.
If in the script I have checked the OS X box and set the contained script for Applies to “Both” ( Debug and Release ). I then have in the build script:
ConstantValue( "App.someConstant" ) = "some text"
and if App.someConstant has no default value, then apparently when the script is run at build time, the empty default value is changed to “some text” and all is well. However if I change “some text” to “different text” in the script and run the build again, then the previous non-empty default value of “some text” remains the value of App.someConstant.
You need to do an “IDE Communicator” script. There should be an example in the example folder. The following code is part of a script that builds a couple of applications:
openfile(basePath + "code\\ current/max\\ scheduler.rbp")
ConstantValue("App.kMaxVersion") = theVersion
if ConstantValue("App.kMaxVersion") = "0" then
PropertyValue("App.Application Identifier") = "com.mothsoftware.mailarchiverx"
PropertyValue("App.MacOSXAppName") = "Mail Archiver X "
elseif ConstantValue("App.kMaxVersion") = "1" then
PropertyValue("App.Application Identifier") = "com.mothsoftware.mailarchiverpro"
PropertyValue("App.MacOSXAppName") = "Mail Archiver X Pro "
else
print ConstantValue("App.kMaxVersion")
end if
Call BuildApp(16)
DoCommand "SaveFile"
DoCommand("CloseWindow")
[quote=394716:@Ed Kleban]Excellent. This is exactly the kind of thing I was looking for. Now the problem is getting it to work right.
If in the script I have checked the OS X box and set the contained script for Applies to “Both” ( Debug and Release ). I then have in the build script:
ConstantValue( "App.someConstant" ) = "some text"
and if App.someConstant has no default value, then apparently when the script is run at build time, the empty default value is changed to “some text” and all is well. However if I change “some text” to “different text” in the script and run the build again, then the previous non-empty default value of “some text” remains the value of App.someConstant.
Any suggestions?[/quote]
I cant confirm that. No matter what I set it to, when I run or build, the constant gets set. How are you checking the new value?
Saving the project might very well be the tripwire I was stumbling over… so let’s say sure; it works now.
However there is another bizarre behavior that does affect it. The whole intent here is to get the name of the source file. So things are working well; I quit my running debug app; and I save the project under a new filename. It’s saved. But if I now run my project in debug, it does not get the current project filename, but rather the last. Running it causes the project to become “unsaved”. So I then do an explicit save… and then all works as expected.
A little non-intuitive, but I can live with that; especially since I most care about the correctness in the compiled build.