| 119 | #endif |
| 120 | |
| 121 | void 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 | |
| 146 | String BinaryAsset::GetImportPath() const |
| 147 | { |
nothing calls this directly
no test coverage detected