MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / GetImportMetadata

Method GetImportMetadata

Source/Engine/Content/BinaryAsset.cpp:121–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119#endif
120
121void BinaryAsset::GetImportMetadata(String& path, String& username) const
122{
123 if (Metadata.IsInvalid())
124 return;
125
126 // Parse metadata and try to get import info
127 rapidjson_flax::Document document;
128 document.Parse((const char*)Metadata.Get(), Metadata.Length());
129 if (document.HasParseError() == false)
130 {
131 path = JsonTools::GetString(document, "ImportPath");
132 username = JsonTools::GetString(document, "ImportUsername");
133 if (path.HasChars() && FileSystem::IsRelative(path))
134 {
135 // Convert path back to thr absolute (eg. if stored in relative format)
136 path = Globals::ProjectFolder / path;
137 StringUtils::PathRemoveRelativeParts(path);
138 }
139 }
140 else
141 {
142 Log::JsonParseException(document.GetParseError(), document.GetErrorOffset(), GetPath());
143 }
144}
145
146String BinaryAsset::GetImportPath() const
147{

Callers

nothing calls this directly

Calls 12

IsRelativeFunction · 0.85
JsonParseExceptionClass · 0.85
GetPathFunction · 0.85
GetParseErrorMethod · 0.80
GetStringFunction · 0.50
IsInvalidMethod · 0.45
ParseMethod · 0.45
GetMethod · 0.45
LengthMethod · 0.45
HasParseErrorMethod · 0.45
HasCharsMethod · 0.45
GetErrorOffsetMethod · 0.45

Tested by

no test coverage detected