-
Notifications
You must be signed in to change notification settings - Fork 2
basic renpy integration #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # SPDX-FileCopyrightText: 2022 PrepPipe's Contributors | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """可执行/基础目录的解析与覆盖,供设置文件、Ren'Py SDK 等路径统一使用。""" | ||
|
|
||
| import os | ||
| import sys | ||
|
|
||
|
|
||
| def _compute_executable_base_dir() -> str: | ||
| """打包运行时为可执行文件所在目录,否则为 preppipe 包所在目录。""" | ||
| if getattr(sys, 'frozen', False): | ||
| return os.path.dirname(sys.executable) | ||
| return os.path.dirname(os.path.abspath(__file__)) | ||
|
|
||
|
|
||
| _executable_base_dir: str = _compute_executable_base_dir() | ||
|
|
||
|
|
||
| def get_executable_base_dir() -> str: | ||
| """返回当前认定的「可执行/基础」目录。""" | ||
| return _executable_base_dir | ||
|
|
||
|
|
||
| def set_executable_base_dir(path: str) -> None: | ||
| """在未打包环境下覆盖基础目录(如 GUI 启动时指定设置目录)。打包后调用无效。""" | ||
| global _executable_base_dir | ||
| if getattr(sys, 'frozen', False): | ||
| return | ||
| _executable_base_dir = os.path.abspath(path) | ||
| if not os.path.isdir(_executable_base_dir): | ||
| raise FileNotFoundError(f"Path '{_executable_base_dir}' does not exist") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.