Unlike most other Operating Systems, RISC OS stores applications in an advanced way. Instead of having application files and resource files spread across multiple folders, all application related files are stored within the applications own ‘folder’. This is called the ‘Applications Directory’. All information relating to how an application functions is stored within the application directory.
Applications are readily identified by its ‘!’ suffix; often pronounced as a ‘Pling’. e.g !Edit, !Draw, !Boot.
Applications are loaded by double-clicking the applications icon, but double-clicking with the shift key depressed opens the application directory showing all the files that make up the application.
Applications are made up of several key files; the following table describes the main files.
Name | File Type | Description |
---|---|---|
!Boot | Obey (&FEB) | This fie is automatically loaded when the application is first seen by the Filer. It is used to set up the sprite to be used for the application’s icon and which file types the application will respond to |
!Run | Obey (&FEB) | This file sets up everything needed for the application and then loads it |
!RunImage | Varies | This is the file that comprises of the application’s main code |
!Sprites | Sprite (&FF9) | This file is used to store important sprites used by the application |
!Choices | Varies | This file is used to store applications settings |
!Help | Text (&FFF) | This file is used to describe the purpose of the application |
!Messages | Text (&FFF) | This file is used to store the text used for windows, dialog boxes and menus |
Templates | Template (&FEC) | This file is used to store window definitions |
!Boot files are automatically loaded by the Wimp when the application is initially seen by the Filer.
An example of a !Boot file for a made-up application called !TextEdit is shown below.
| Sprites and File types to use IconSprites <Obey$Dir>.!Sprites Set Alias$RunType_FFF Run <Obey$Dir>.!Run %%*0 Set File$Type_FFF TEXT … Set TextEdit$Dir <Obey$Dir>
This example code tells the Wimp which sprite file to use1 and then state that it can load files with file types of &FFF (text files). It finally sets an environment variable that sets the pathname for the application.
Any file with a file type of &FFF will be displayed using the icon as described in the sprites file. If the files are double-clicked the application will load itself (if not already loaded) and then proceed to load the file.
Annotations
fn1. The Wimp will add a prefix to the sprite file depending on the screen mode in use at the time.
The !Run file is automatically executed when an application is to be loaded. At its most simplest, its purpose is to confirm that the application can be loaded successfully and then actually loads the application if possible.
An example of a !Run file for a made-up application called !TextEdit is shown below.
| Making a copy to the application’s pathname Set TextEdit$Dir <Obey$Dir> | Required versions of modules to load application RMEnsure FPEmulator 4.03 RMLoad System:Modules.FPEmulator RMEnsure FPEmulator 4.03 Error You need FPEmulator 4.03 or Later | Memory Management WimpSlot –min 256K –max 512K | Run the application code Run "<TextEdit$Dir>.!RunImage" %*0
A copy of the pathname from Obey$Dir
is required. Other macros could change the setting of Obey$Dir
so it is safer to make a copy and use that instead. This new reference to the application’s path can then be safely used within the application itself to access files etc..
The application then checks that any required modules are present and loaded by using *RMEnsure. If the module is not supplied with the application then it must be checked twice. Once to try and load the required module, and the second to check the required version is present.
The Application then tries to assign a dedicated amount of memory for the application using *WimpSlot. More memory can always be set aside if required by the application if required.
Finally, it then tries to execute the !RunImage file. Only one %
sign is required this time, and there must be no CR/LF after this line, else the file will remain open until the application is quit.
Notes:
*Run <Obey$Dir>.!Boot
System$Path
is defined and produce an error if it is not. e.g.*If "<System$Path>" = "" Then Error 0 System resources is not found
This file is conventionally used to store the main code of the application. The !Run file loads this file after it has checked that the system can load the application successfully.
The date stamp on this file is also used as the date stamp of the application, if the Filer is displaying in ‘Full Info’ mode.
This file is used to store several important sprites used by the application. In actual use, the Wimp may not use a different file depending on the screen mode in use. See Icon Sets for more details.
The Wimp can assign a different sprite to any type of file type. Many common file types have already pre-assigned sprites. If an application handles a file type that is not already handled natively by RISC OS, then it should specify a sprite that represents that particular file type.
The following sprites should be available within the relevant !Sprites
file.
Name | Description |
---|---|
!app | Sprite used to represent the application itself |
sm!app | Sprite used to represent the application when filer is set to display small icons |
file_fff | Sprite used to represent the file type within Filer windows |
small_fff | Sprite used to represent the file type within Filer windows when the Filer is set to display small icons |
Applications that allow for the Applications settings to be changed by the user should store the settings in the !Choices file. The data format used to store the settings can range from a simple text file to a proprietary data format.
The !Help file is a text file that is used to convey the purpose of the application and any other important information.
If the !Help file is present it will appear as a sub-menu option, if the user clicks the menu button over the applications icon within the filer window.
This is the file that is often used to store text used within an application. i.e. windows, dialog boxes and menus. This enables a developer to quickly customize the application for different languages by supplying different message files for each language supported.
Resource files, such as message files should be loaded at the same time as the application to ensure that it does not have to request access later when the path may no longer be accessible. e.g. application was loaded from a CD, that is no longer present.
Template files are used to store window definitions that the application can load and display easily and quickly. For a full description please see Template Files.
RISC OS has many guidelines on the appropriate use of resource files. For a complete detailed guide on resource files, please see the RISC OS Style Guide.