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

Method expandAssetFilePath

Engine/source/assets/assetBase.cpp:180–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178//-----------------------------------------------------------------------------
179
180StringTableEntry AssetBase::expandAssetFilePath(const char* pAssetFilePath) const
181{
182 // Debug Profiling.
183 PROFILE_SCOPE(AssetBase_ExpandAssetFilePath);
184
185 // Sanity!
186 AssertFatal(pAssetFilePath != NULL, "Cannot expand a NULL asset path.");
187
188 // Fetch asset file-path length.
189 const U32 assetFilePathLength = dStrlen(pAssetFilePath);
190
191 // Are there any characters in the path?
192 if (assetFilePathLength == 0)
193 {
194 // No, so return empty.
195 return StringTable->EmptyString();
196 }
197
198 // Fetch the asset base-path hint.
199 StringTableEntry assetBasePathHint;
200 if (getOwned() && !getAssetPrivate())
201 {
202 assetBasePathHint = mpOwningAssetManager->getAssetPath(getAssetId());
203 }
204 else
205 {
206 assetBasePathHint = NULL;
207 }
208
209 // Expand the path with the asset base-path hint.
210 char assetFilePathBuffer[1024];
211 Con::expandPath(assetFilePathBuffer, sizeof(assetFilePathBuffer), pAssetFilePath, assetBasePathHint);
212 return StringTable->insert(assetFilePathBuffer);
213}
214
215//-----------------------------------------------------------------------------
216

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