MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / expandAssetFilePath

Method expandAssetFilePath

Engine/source/assets/assetBase.cpp:198–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196//-----------------------------------------------------------------------------
197
198StringTableEntry AssetBase::expandAssetFilePath(const char* pAssetFilePath) const
199{
200 // Debug Profiling.
201 PROFILE_SCOPE(AssetBase_ExpandAssetFilePath);
202
203 // Sanity!
204 AssertFatal(pAssetFilePath != NULL, "Cannot expand a NULL asset path.");
205
206 // Fetch asset file-path length.
207 const U32 assetFilePathLength = dStrlen(pAssetFilePath);
208
209 // Are there any characters in the path?
210 if (assetFilePathLength == 0)
211 {
212 // No, so return empty.
213 return StringTable->EmptyString();
214 }
215
216 // Fetch the asset base-path hint.
217 StringTableEntry assetBasePathHint;
218 if (getOwned() && !getAssetPrivate())
219 {
220 assetBasePathHint = mpOwningAssetManager->getAssetPath(getAssetId());
221 }
222 else
223 {
224 assetBasePathHint = NULL;
225 }
226
227 // Expand the path with the asset base-path hint.
228 char assetFilePathBuffer[1024];
229 Con::expandPath(assetFilePathBuffer, sizeof(assetFilePathBuffer), pAssetFilePath, assetBasePathHint);
230 return StringTable->insert(assetFilePathBuffer);
231}
232
233//-----------------------------------------------------------------------------
234

Callers

nothing calls this directly

Calls 5

expandPathFunction · 0.85
EmptyStringMethod · 0.80
getAssetPathMethod · 0.80
dStrlenFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected