0 votes

Since I am using Google Fonts and some plugins which are licensed under MIT/SIL licenses I have created a licenses folder to collect all of these.

My idea was to include them into my game exports and ship them with the game. Is there a possibility to include this folder with .txt files unpacked/ uncompressed automatically into my game exports so that its readable for users?

Is that even neccessary to have it shipped in an unpacked format?

Thanks in advance for your ideas/ advice.

Godot version 3.2.3
in Engine by (21 points)

1 Answer

+1 vote
Best answer

You can export .txt files in your packed game by simply adding them to the resource section when exporting:

including *.txt in the export resource window

This will include them in your .pck files, and if opened with an archive manager they will appear there.

If you want them included in your application, in an about section or something similar, you could place all the .txt liscences in a folder and read them into a series of labels with something like this:

func load_files(path):
    var dir = Directory.new()
    dir.open(path)
    dir.list_dir_begin()

    while true:
        var filePath = dir.get_next()
        if filePath == "":
            break
        elif filePath.ends_with(".txt"):
            var file = File.new()
            file.open(filePath, File.READ)
            var content = file.get_as_text()
            # Assign string #
            file.close()
by (122 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.