Skip to content

Commit 42f2b64

Browse files
committed
Merge pull request #11762 from Calinou/creating-applications-single-exe-portable
Document creating single-executable/portable apps in Creating applications
1 parent f563718 commit 42f2b64

2 files changed

Lines changed: 60 additions & 12 deletions

File tree

tutorials/export/exporting_for_windows.rst

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ The default is x86_64, this is the most common architecture of PC processors
3232
today. All modern Intel and AMD processors as of writing this are x86_64.
3333

3434
x86_32 will give you a 32bit executable that can run on 32bit-only versions of
35-
Windows as well as modern versions which are 64bit. It is NOT recommended to use
35+
Windows as well as modern versions which are 64bit. It is **not** recommended to use
3636
this option unless you are trying to get your project to run on an old 32bit version
3737
of Windows. And it should be noted that no 32bit versions of Windows receive
3838
Microsoft support anymore.
3939

4040
arm64 processors are modern but less common than x86_64, and run Windows on ARM.
4141
Snapdragon X Elite is an example of a modern Windows ARM processor. Using this
4242
export option will allow your project to run natively on arm processors without
43-
Microsoft's Prism emulator. Executables made using this option will NOT run on
43+
Microsoft's Prism emulator. Executables made using this option will **not** run on
4444
regular Windows with an x86_64 processor. If you're uploading your project to a
4545
platform that allows multiple executables, such as itch.io, and are confident a
4646
Snapdragon X Elite processor is powerful enough to run it, we would recommend
@@ -55,6 +55,14 @@ settings, and convert it to an ICO file for the exported project. If you want to
5555
manually create an ICO file for greater control over how the icon looks at different
5656
resolutions then see the :ref:`doc_changing_application_icon_for_windows` page.
5757

58+
PCK embedding
59+
-------------
60+
61+
PCK embedding is only supported on executables up to ~3.89 GB in size. This
62+
metric includes both the executable and embedded PCK size, so in practice,
63+
the PCK file may only weigh up to ~3.75 GB. This can also vary depending on
64+
build options when using a custom export template.
65+
5866
.. _doc_exporting_for_windows_code_signing:
5967

6068
Code signing
@@ -65,16 +73,6 @@ Godot is capable of automatic code signing on export. To do this you must have t
6573
(on any other OS) installed. You will also need a package signing certificate,
6674
information on creating one can be found `here <https://learn.microsoft.com/en-us/windows/msix/package/create-certificate-package-signing>`__.
6775

68-
.. warning::
69-
70-
If you export for Windows with embedded PCK files, you will not be able to
71-
sign the program as it will break.
72-
73-
On Windows, PCK embedding is also known to cause false positives in
74-
antivirus programs. Therefore, it's recommended to avoid using it unless
75-
you're distributing your project via Steam as it bypasses code signing and
76-
antivirus checks.
77-
7876
Setup
7977
~~~~~
8078

tutorials/ui/creating_applications.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,56 @@ The size reduction is often significant (relative to the project's size),
738738
since applications contain fewer large assets compared to games.
739739
See :ref:`doc_optimizing_for_size` for more information on how to do this.
740740

741+
Creating a single-executable distribution
742+
-----------------------------------------
743+
744+
By default, Godot creates a PCK file containing the project data next to the
745+
executable. This means that if the executable is moved without moving the PCK
746+
file at the same time, the application will not run. This is not ideal for
747+
applications, which are increasingly being distributed as a single executable
748+
file.
749+
750+
To make the application entirely self-contained to a single executable, you can
751+
enable **Embed PCK** in the export preset options. This will embed the PCK data
752+
within the executable, so that the application can be moved around without
753+
breaking. This also makes it possible to run the application directly from a ZIP
754+
archive without having to extract it first.
755+
756+
.. note::
757+
758+
PCK embedding has a size limitation depending on the platform. Very large
759+
applications (several GBs) may not be able to use this feature on all platforms.
760+
Check the export documentation for the target platform for more details.
761+
762+
Creating portable applications
763+
------------------------------
764+
765+
An application is called *portable* when it can be run without installation, and
766+
when its configuration is entirely self-contained to the folder it was extracted
767+
to. This allows placing the application files on an USB drive or similar, and
768+
running it on different machines without having to go through an installation
769+
process.
770+
771+
The Godot editor's own :ref:`self-contained mode <doc_data_paths_self_contained_mode>`
772+
currently can't be used within projects. However, you can still choose to save
773+
your own configuration files to the folder containing the executable as follows:
774+
775+
::
776+
777+
var config_path = OS.get_executable_path().get_base_dir().path_join("config.ini")
778+
# Then use `config_path` to save/load configuration files using ConfigFile or similar.
779+
780+
You may want to make portable mode optional as it's not always desired.
781+
Typically, this is performed by detecting the presence of a specific file in the
782+
executable's folder (e.g. a file named ``portable.txt``), and only using the
783+
executable's folder for configuration if that file is present.
784+
785+
.. warning::
786+
787+
Remember that this will only work if the application is extracted to a
788+
writable location. This will result in permission errors if the executable
789+
is run from a read-only location, such as ``C:\Program Files`` on Windows.
790+
741791
Creating installers
742792
-------------------
743793

0 commit comments

Comments
 (0)