- Integrating resources when generating the iPhone/iPad application
- Handling the read-only files found in the directory of resources
In french: fRepRessource
Returns the path of the read-only resources of the application.
// The function returns the content of the file
fLoadBuffer(fResourceDir() + ["\"] + "data.bin")
<Result> = fResourceDir()
<Result>: Character string
Full path of the read-only resources found in the application. Corresponds to the ".app" directory of the application. You cannot write into this directory.
Integrating resources when generating the iPhone/iPad application
The iOS application generation wizard allows you to include files in the executable. You can include:
- specific resources.
- specific images.
- data files.
If the "Write" option is checked for the files, these files will be automatically extracted (e.g., files that must be modified by the application). In this case, specify the application directory into which this file must be extracted ("Documents" directory or "Library" directory).
If the "Write" option is unchecked for the files, these files can be:
- used directly (files to read for example: sound files, image files, etc.). These files are included in the application and they will not be extracted. fResourceDir is used to access these files in read-only mode.
- extracted through programming with fExtractResource.
Caution: The iOS system is case-sensitive.
Handling the read-only files found in the directory of resources
The tree structure of the resource directory is identical to the tree structure of the project directory on the development computer:
- on the development computer, the resource included in the Xcode project can be found in a directory such as:
<Project_Name>\EXE\<Configuration name>\<Custom directory>.
- on iPhone or iPad, the resource will be in a directory such as:
fResourceDir() + \EXE\<Configuration name>\<Custom directory>.
Example: the following code checks if the "stop.png" file is in the directory of the resources. On the development computer, this file is in the "C:\My Projects\MyApp\Exe\iOS Application\stop.png" directory.
On iPhone or iPad, this path corresponds to: "<Application directory>/MyApp.app/Exe/iOS Application/stop.png".
IF fFileExist(CompleteDir(fResourceDir()) + CompleteDir("Exe") + ...
CompleteDir("iOS Application") + "stop.png") = True THEN
Info("The image was found")
Info("Image not found.")
This page is also available for…