[ZIPPacker] Add support for Unix permissions and modification time.#115946
Merged
Conversation
akien-mga
reviewed
Feb 6, 2026
| <method name="add_directory"> | ||
| <return type="int" enum="Error" /> | ||
| <param index="0" name="path" type="String" /> | ||
| <param index="1" name="permissions" type="int" enum="FileAccess.UnixPermissionFlags" is_bitfield="true" default="493" /> |
Member
There was a problem hiding this comment.
The default value seems confusing, how does it match 0755?
Member
Author
There was a problem hiding this comment.
Octal 0755 = decimal 493, I do not think we can control how it's showing in the docs.
Member
Author
There was a problem hiding this comment.
For the enum/bit field values, it might be worth to show it as the list of constants instead of value (or in addition to value).
A quick draft (probably not the best place to add it, will check how to do it proper way next week):
diff
diff --git a/editor/doc/doc_tools.cpp b/editor/doc/doc_tools.cpp
index 5bdd6390ce..e5a5da7fc5 100644
--- a/editor/doc/doc_tools.cpp
+++ b/editor/doc/doc_tools.cpp
@@ -1612,7 +1612,43 @@ static void _write_method_doc(Ref<FileAccess> f, const String &p_name, Vector<Do
}
if (!a.default_value.is_empty()) {
- _write_string(f, 3, "<param index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape(true) + "\" type=\"" + a.type.xml_escape(true) + "\"" + enum_text + " default=\"" + a.default_value.xml_escape(true) + "\" />");
+ String dval = a.default_value.xml_escape(true);
+ if (!a.enumeration.is_empty() && a.type.xml_escape(true) == "int") {
+ if (a.is_bitfield) {
+ int64_t cval = dval.to_int();
+ String cname = a.enumeration.xml_escape(true).get_slice(".", 0);
+ String ename = a.enumeration.xml_escape(true).get_slice(".", 1);
+ List<StringName> consts;
+ ClassDB::get_enum_constants(cname, ename, &consts);
+ dval = String();
+ for (const StringName &c : consts) {
+ int64_t val = ClassDB::get_integer_constant(cname, c);
+ if ((cval & val) == val) {
+ if (!dval.is_empty()) {
+ dval += " | ";
+ }
+ dval += c;
+ cval &= ~val;
+ }
+ }
+ if (cval != 0) {
+ dval += " | " + itos(cval);
+ }
+ } else {
+ int64_t cval = dval.to_int();
+ String cname = a.enumeration.xml_escape(true).get_slice(".", 0);
+ String ename = a.enumeration.xml_escape(true).get_slice(".", 1);
+ List<StringName> consts;
+ ClassDB::get_enum_constants(cname, ename, &consts);
+ for (const StringName &c : consts) {
+ if (cval == ClassDB::get_integer_constant(cname, c)) {
+ dval = c;
+ break;
+ }
+ }
+ }
+ }
+ _write_string(f, 3, "<param index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape(true) + "\" type=\"" + a.type.xml_escape(true) + "\"" + enum_text + " default=\"" + dval + "\" />");
} else {
_write_string(f, 3, "<param index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape(true) + "\" type=\"" + a.type.xml_escape(true) + "\"" + enum_text + " />");
}Produce following docs, which looks more readable:
<method name="open">
<return type="int" enum="Error" />
<param index="0" name="path" type="String" />
<param index="1" name="append" type="int" enum="ZIPPacker.ZipAppend" default="APPEND_CREATE" />
<description>
Opens a zip file for writing at the given path using the specified write mode.
This must be called before everything else.
</description>
</method>
<method name="start_file">
<return type="int" enum="Error" />
<param index="0" name="path" type="String" />
<param index="1" name="permissions" type="int" enum="FileAccess.UnixPermissionFlags" is_bitfield="true" default="UNIX_READ_OWNER | UNIX_WRITE_OWNER | UNIX_READ_GROUP | UNIX_READ_OTHER" />
<param index="2" name="modified_time" type="int" default="0" />
<description>
Starts writing to a file within the archive. Only one file can be written at the same time. If [param modified_time] is set to [code]0[/code], current system time is used.
Must be called after [method open].
</description>
</method>
Member
There was a problem hiding this comment.
For the record, I just saw this PR which seems adjacent (for inspector, not docs).
akien-mga
approved these changes
Feb 6, 2026
AThousandShips
approved these changes
Feb 6, 2026
Contributor
|
Thanks! |
rivie13
pushed a commit
to rivie13/Phoenix-Agentic-Engine
that referenced
this pull request
Feb 16, 2026
[ZIPPacker] Add support for Unix permissions and modification time.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.