aboutsummaryrefslogtreecommitdiff
path: root/core/io/resource_import.cpp
diff options
context:
space:
mode:
authorAndreas Haas2017-08-15 22:21:53 +0200
committerGitHub2017-08-15 22:21:53 +0200
commit2d0e7a521f4dee488f763929cea57c8888c2fb74 (patch)
treee410359a3ef8c7fcf2fe9e20f0cac0e53e40e5e8 /core/io/resource_import.cpp
parent860816f3d3b8dda27c1f9774a08e0e0fc003a30f (diff)
parent155402dc1b6b4e9113b0ffc737182ce1956efe97 (diff)
downloadgodot-2d0e7a521f4dee488f763929cea57c8888c2fb74.tar.gz
godot-2d0e7a521f4dee488f763929cea57c8888c2fb74.tar.zst
godot-2d0e7a521f4dee488f763929cea57c8888c2fb74.zip
Diffstat (limited to 'core/io/resource_import.cpp')
-rw-r--r--core/io/resource_import.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/core/io/resource_import.cpp b/core/io/resource_import.cpp
index 61da4f335..7033dbe5f 100644
--- a/core/io/resource_import.cpp
+++ b/core/io/resource_import.cpp
@@ -199,6 +199,52 @@ String ResourceFormatImporter::get_internal_resource_path(const String &p_path)
return pat.path;
}
+void ResourceFormatImporter::get_internal_resource_path_list(const String &p_path, List<String> *r_paths) {
+
+ Error err;
+ FileAccess *f = FileAccess::open(p_path + ".import", FileAccess::READ, &err);
+
+ if (!f)
+ return;
+
+ VariantParser::StreamFile stream;
+ stream.f = f;
+
+ String assign;
+ Variant value;
+ VariantParser::Tag next_tag;
+
+ int lines = 0;
+ String error_text;
+ while (true) {
+
+ assign = Variant();
+ next_tag.fields.clear();
+ next_tag.name = String();
+
+ err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true);
+ if (err == ERR_FILE_EOF) {
+ memdelete(f);
+ return;
+ } else if (err != OK) {
+ ERR_PRINTS("ResourceFormatImporter::get_internal_resource_path_list - " + p_path + ".import:" + itos(lines) + " error: " + error_text);
+ memdelete(f);
+ return;
+ }
+
+ if (assign != String()) {
+ if (assign.begins_with("path.")) {
+ r_paths->push_back(value);
+ } else if (assign == "path") {
+ r_paths->push_back(value);
+ }
+ } else if (next_tag.name != "remap") {
+ break;
+ }
+ }
+ memdelete(f);
+}
+
String ResourceFormatImporter::get_resource_type(const String &p_path) const {
PathAndType pat;