How do I include additional files and folders in my application builds?
To include additional files and folders in your application builds created using levurePackageApplication
, for example database and media files, use the copy files
section in app.yml
. copy files
is part of the build profiles
section. This allows you to target the files and folders you want to copy in a very general or very specific way.
# app.yml
build profiles:
all profiles:
copy files:
package folder:
all platforms:
macos:
macos resources:
windows:
linux:
ios:
android:
When packaging an application the folder structure you specify in the copy files
instructions will be maintained in the packaged application. This allows you to use the same code for referencing your database, media, and other files regardless of whether you are running your app in the IDE or as a standalone application. For example, if you store your media files in an assets
folder that sits alongside the app.yml
file then you would reference those media files as follows:
put levureAppFolder() & "/assets/MyMediaFile.png" into tFilename
You would use the following copy files
rule to make sure the assets
folder is copied over.
build profiles:
all profiles:
copy files:
all platforms:
- filename: assets
IMPORTANT: Do not use the "Copy Files" pane in the LiveCode Standalone Application Settings, because it may not copy nested folders and subfolders properly. Always use the copy files
section in app.yml
to include additional files and folders in your builds.
- Include files in the root of app folder
- Include files in nested folders in app folder
- Include folders in the root of app folder
- Include specific subfolders in nested folders in app folder
- Copy files into the folder where the application is being packaged
- Copy files into the ./Contents/Resources folder of your packaged macOS application
To copy specific files in the root of the app
folder into the same relative location in the distribution build...
- 📂 app
- app.yml
- app.livecodescript
- standalone.livecode
- file_to_copy_1.ext
- file_to_copy_2.ext
...put this in the copy files
section in app.yml
:
build profiles:
all profiles:
copy files:
all platforms:
- filename: ./file_to_copy_1.ext
- filename: ./file_to_copy_2.ext
macos:
macos resources:
windows:
linux:
ios:
android:
To copy specific files only on iOS and Android, do this:
build profiles:
all profiles:
copy files:
all platforms:
macos:
macos resources:
windows:
linux:
ios:
- filename: ./file_to_copy_1.ext
android:
- filename: ./file_to_copy_2.ext
To copy specific files in nested folders in the app
folder into the same relative locations in the distribution build...
- 📂 app
- app.yml
- app.livecodescript
- standalone.livecode
- 📂 nested_folder_1
- file_to_copy_1.ext
- 📂 nested_folder_2
- 📂 sub_folder
- file_to_copy_2.ext
- 📂 sub_folder
...put this in the copy files
section in app.yml
:
build profiles:
all profiles:
copy files:
all platforms:
- filename: ./nested_folder_1/file_to_copy_1.ext
destination: ./nested_folder_1
- filename: ./nested_folder_2/sub_folder/file_to_copy_2.ext
destination: ./nested_folder_2/sub_folder
macos:
macos resources:
windows:
linux:
ios:
android:
To copy specific folders in the root of the app folder with all of their contents, including subfolders, into the same relative location in the distribution build...
- 📂 app
- app.yml
- app.livecodescript
- standalone.livecode
- 📁 folder_to_copy_1
- 📁 folder_to_copy_2
...put this in the copy files
section in app.yml
:
build profiles:
all profiles:
copy files:
all platforms:
- filename: ./folder_to_copy_1
- filename: ./folder_to_copy_2
macos:
macos resources:
windows:
linux:
ios:
android:
To copy specific subfolders in nested folders in the app
folder into the same relative locations in the distribution build...
- 📂 app
- app.yml
- app.livecodescript
- standalone.livecode
- 📂 nested_folder
- 📁 sub_folder_to_copy_1
- 📁 sub_folder_to_copy_2
- 📁 sub_folder_to_exclude
...put this in the copy files
section in app.yml
:
build profiles:
all profiles:
copy files:
all platforms:
- filename: ./nested_folder/sub_folder_to_copy_1
destination: ./nested_folder
- filename: ./nested_folder/sub_folder_to_copy_2
destination: ./nested_folder
macos:
macos resources:
windows:
linux:
ios:
android:
NOTE: The above settings will only copy sub_folder_to_copy_1
and sub_folder_to_copy_2
into the distribution build. The subfolder sub_folder_to_exclude
will not be copied.
For situations where you need to copy files into the folder where the application is being packaged use the package folder
section. This will place files one level above the folders where the operating system-specific builds are placed.
To copy specific files stored outside of the app
folder into the target packaging folder...
- 📂 myapp
- 📂 app
- app.yml
- app.livecodescript
- standalone.livecode
- 📂 build files
- psvince.dll
- MyApp.iss
- 📂 app
...put this in the copy files
section in app.yml
:
build profiles:
all profiles:
copy files:
package folder:
- filename: ../build files/psvince.dll
- filename: ../build files/MyApp.iss
The above example copies files for building a Windows installer using Inno Setup.
When packaging an application for macOS you may need to add files to the ./Contents/Resources
folder of the app. Entitlement files used for code signing an app that will be notarized or submitted to the Mac App Store are good examples.
To copy specific files stored outside of the app
folder into the ./Contents/Resources
folder of the packaged application...
- 📂 myapp
- 📂 app
- app.yml
- app.livecodescript
- standalone.livecode
- 📂 build files
- MyApp.entitlements
- 📂 app
...put this in the copy files
section in app.yml
:
build profiles:
all profiles:
copy files:
macos:
macos resources:
- filename: ../build files/MyApp.entitlements
windows:
linux:
ios:
android:
Note: When Levure finds an .entitlements
file in the Resources
folder that has the same name as the application then it will include the file when code signing the application.
Levure is an application development framework written for LiveCode.