Easily Manage your Application’s Information

Automatically translated from English

To build your application, you use the BUILD APPLICATION command with a set of XML keys that allow you to configure the built application. For most of you, this option is enough for application building. However, we want to make sure we meet your specific needs too, so we’ll simplify the BUILD APPLICATION command by splitting it. This will allow for more flexibility while creating applications.

After the build process, it’s possible to add information such as company, copyright, or version for the application. In future releases, we will continue to enhance that to give you full control over compile, build (which is in fact just copying files together) and signing the result. Setting copyright info is just the first step.

Starting with 4D v19, you can read, add or modify them on Windows or macOS platform. Here’s how to do it:

Windows application

The application’s information is contained in the executable file. You can define the following:

  • InternalName
  • ProductName
  • ProductVersion
  • LegalCopyright
  • CompanyName
  • FileDescription
  • FileVersion
  • OriginalFilename

 

That information is then displayed in the 4D Properties window:

We have added two new functions to the File class to allow reading and writing application information.

  • To add the information, pass an object with the attributes you want to set to the setAppInfo function:

var $exeFile : 4D.File
var $info : Object
$exeFile:= File("...executable path...")
$info:=New object
$info.LegalCopyright:="Copyright My App 2021"
$info.ProductVersion:="1.0.0"
$info.InternalName:="My App"
$exeFile.setAppInfo($info)

  • To read the information, simply use getAppInfo, and you get all the attributes in one object:

var $exeFile : 4D.File
var $info : Object
$exeFile:= File("...executable path...")  
$info:=$exeFile.getAppInfo()

Since the functions that allow manipulating information about an executable file use the Windows API, you can only use them on Windows.

macOS application

On macOS, the application’s information is contained in a specific file named info.plist:

  • CFBundleName and CFBundleDisplayName
  • CFBundleShortVersionString and CFBundleVersion
  • CFBundleIconFile
  • etc.

For more details on the possible keys, we recommend reading Apple’s documentation.

 

This example adds some keys to an existing file:

var $plistFile : 4D.File
var $info : Object
$pListFile:= File("...info.plist path...")
$info:=New object
$info.CFBundleDisplayName:="My Application"
$info.CFBundleName:="myApp"
$info.CFBundleIconFile:="myapp.icns"
$pListFile.setAppInfo($info)

Of course, we have also added a “getAppInfo” method, similar to the one in the Windows example.

var $exeFile : 4D.File
var $info : Object
$exeFile:= File("...info.plist path...")  
$info:=$exeFile.getAppInfo()

More features are coming to ease your developers’ life. Stick around for more updates.

Vanessa Talbot

• Product Owner •

Vanessa Talbot joined 4D Program team in June, 2014. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.

Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.