MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / GetFileSize

Function GetFileSize

src/openrct2/platform/Platform.Android.cpp:191–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189 }
190
191 uint64_t GetFileSize(std::string_view path)
192 {
193 if (String::startsWith(path, Platform::kAndroidAssetPathPrefix))
194 {
195 auto assetManager = static_cast<AAssetManager*>(GetAssetManager());
196 if (assetManager != nullptr)
197 {
198 std::string assetPath = std::string(path).substr(Platform::kAndroidAssetPathPrefix.length());
199 auto asset = AAssetManager_open(assetManager, assetPath.c_str(), AASSET_MODE_UNKNOWN);
200 if (asset != nullptr)
201 {
202 auto size = AAsset_getLength64(asset);
203 AAsset_close(asset);
204 return size;
205 }
206 }
207 return 0;
208 }
209
210 uint64_t size = 0;
211 struct stat statInfo{};
212 if (stat(std::string(path).c_str(), &statInfo) == 0)
213 {
214 size = statInfo.st_size;
215 }
216 return size;
217 }
218
219 #ifndef DISABLE_TTF
220 std::string GetFontPath(const TTFFontDescriptor& font)

Callers

nothing calls this directly

Calls 3

startsWithFunction · 0.85
GetAssetManagerFunction · 0.85
statClass · 0.70

Tested by

no test coverage detected