Merge pull request #49173 from KoBeWi/navigational_oblivion
Tweak arguments of list_dir_begin() (skips navigational and hidden files by default)
This commit is contained in:
commit
643da45e16
|
@ -1616,11 +1616,11 @@ bool _Directory::is_open() const {
|
||||||
return d && dir_open;
|
return d && dir_open;
|
||||||
}
|
}
|
||||||
|
|
||||||
Error _Directory::list_dir_begin(bool p_skip_navigational, bool p_skip_hidden) {
|
Error _Directory::list_dir_begin(bool p_show_navigational, bool p_show_hidden) {
|
||||||
ERR_FAIL_COND_V_MSG(!is_open(), ERR_UNCONFIGURED, "Directory must be opened before use.");
|
ERR_FAIL_COND_V_MSG(!is_open(), ERR_UNCONFIGURED, "Directory must be opened before use.");
|
||||||
|
|
||||||
_list_skip_navigational = p_skip_navigational;
|
_list_skip_navigational = !p_show_navigational;
|
||||||
_list_skip_hidden = p_skip_hidden;
|
_list_skip_hidden = !p_show_hidden;
|
||||||
|
|
||||||
return d->list_dir_begin();
|
return d->list_dir_begin();
|
||||||
}
|
}
|
||||||
|
@ -1758,7 +1758,7 @@ Error _Directory::remove(String p_name) {
|
||||||
|
|
||||||
void _Directory::_bind_methods() {
|
void _Directory::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("open", "path"), &_Directory::open);
|
ClassDB::bind_method(D_METHOD("open", "path"), &_Directory::open);
|
||||||
ClassDB::bind_method(D_METHOD("list_dir_begin", "skip_navigational", "skip_hidden"), &_Directory::list_dir_begin, DEFVAL(false), DEFVAL(false));
|
ClassDB::bind_method(D_METHOD("list_dir_begin", "show_navigational", "show_hidden"), &_Directory::list_dir_begin, DEFVAL(false), DEFVAL(false));
|
||||||
ClassDB::bind_method(D_METHOD("get_next"), &_Directory::get_next);
|
ClassDB::bind_method(D_METHOD("get_next"), &_Directory::get_next);
|
||||||
ClassDB::bind_method(D_METHOD("current_is_dir"), &_Directory::current_is_dir);
|
ClassDB::bind_method(D_METHOD("current_is_dir"), &_Directory::current_is_dir);
|
||||||
ClassDB::bind_method(D_METHOD("list_dir_end"), &_Directory::list_dir_end);
|
ClassDB::bind_method(D_METHOD("list_dir_end"), &_Directory::list_dir_end);
|
||||||
|
|
|
@ -467,7 +467,7 @@ public:
|
||||||
|
|
||||||
bool is_open() const;
|
bool is_open() const;
|
||||||
|
|
||||||
Error list_dir_begin(bool p_skip_navigational = false, bool p_skip_hidden = false); // This starts dir listing.
|
Error list_dir_begin(bool p_show_navigational = false, bool p_show_hidden = false); // This starts dir listing.
|
||||||
String get_next();
|
String get_next();
|
||||||
bool current_is_dir() const;
|
bool current_is_dir() const;
|
||||||
|
|
||||||
|
|
|
@ -154,14 +154,14 @@
|
||||||
<method name="list_dir_begin">
|
<method name="list_dir_begin">
|
||||||
<return type="int" enum="Error">
|
<return type="int" enum="Error">
|
||||||
</return>
|
</return>
|
||||||
<argument index="0" name="skip_navigational" type="bool" default="false">
|
<argument index="0" name="show_navigational" type="bool" default="false">
|
||||||
</argument>
|
</argument>
|
||||||
<argument index="1" name="skip_hidden" type="bool" default="false">
|
<argument index="1" name="show_hidden" type="bool" default="false">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Initializes the stream used to list all files and directories using the [method get_next] function, closing the current opened stream if needed. Once the stream has been processed, it should typically be closed with [method list_dir_end].
|
Initializes the stream used to list all files and directories using the [method get_next] function, closing the current opened stream if needed. Once the stream has been processed, it should typically be closed with [method list_dir_end].
|
||||||
If [code]skip_navigational[/code] is [code]true[/code], [code].[/code] and [code]..[/code] are filtered out.
|
If [code]show_navigational[/code] is [code]true[/code], [code].[/code] and [code]..[/code] are included too.
|
||||||
If [code]skip_hidden[/code] is [code]true[/code], hidden files are filtered out.
|
If [code]show_hidden[/code] is [code]true[/code], hidden files are included too.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="list_dir_end">
|
<method name="list_dir_end">
|
||||||
|
|
Loading…
Reference in New Issue