From 732ef3af11ad3a21fb9ddab612523094ab47a5d6 Mon Sep 17 00:00:00 2001 From: Tom Rothamel Date: Sun, 12 Jan 2025 15:25:28 -0500 Subject: [PATCH] Create libs/ and lib/libs.txt. The latter is the flags file that will load the libs directory in libs mode. --- gui/game/libs/libs.txt | 1 + launcher/game/gui7.rpy | 9 +++++++++ launcher/game/gui7/__init__.py | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 gui/game/libs/libs.txt diff --git a/gui/game/libs/libs.txt b/gui/game/libs/libs.txt new file mode 100644 index 000000000..51b89286c --- /dev/null +++ b/gui/game/libs/libs.txt @@ -0,0 +1 @@ +## When this file exists, Ren'Py will load files in game/libs before other files in game. diff --git a/launcher/game/gui7.rpy b/launcher/game/gui7.rpy index 62115454d..baffc2e94 100644 --- a/launcher/game/gui7.rpy +++ b/launcher/game/gui7.rpy @@ -26,6 +26,15 @@ define gui.asian = False # and provides the full path to the template project. default gui_template_path = None +define LIBS_TXT = _("""\ +The game/libs/ directory is meant for third-party libraries that ask to be put in +game/libs. + +When this file (game/libs/libs.txt) is present, Ren'Py will load all files in libs +before any other file in game/, and will not consider directory names when loading +these files. +""") + init -1 python: import gui7 diff --git a/launcher/game/gui7/__init__.py b/launcher/game/gui7/__init__.py index c55ccc821..36426fc26 100644 --- a/launcher/game/gui7/__init__.py +++ b/launcher/game/gui7/__init__.py @@ -28,15 +28,19 @@ import os import shutil + def finish(p): - for dn in [ "images", "audio" ]: + for dn in [ "images", "audio", "libs" ]: fulldn = os.path.join(p.prefix, dn) if not os.path.exists(fulldn): os.mkdir(fulldn) + with open(os.path.join(p.prefix, "libs", "libs.txt"), "w") as f: + f.write(renpy.translation.translate_string(renpy.store.LIBS_TXT, language=p.language)) + def generate_gui(p): ImageGenerator(p).generate_all()