MCPcopy Create free account
hub / github.com/DavidColson/Polybox / VFSPathToRealPath

Function VFSPathToRealPath

source/virtual_filesystem.cpp:5–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3// ***********************************************************************
4
5bool VFSPathToRealPath(String vfsPath, String& outRealPath, Arena* pArena) {
6 StringBuilder builder(g_pArenaFrame);
7 builder.Append("system/");
8
9 // absolute path, so map the mount point to a real path
10 if (vfsPath[0] == '/') {
11 if (strncmp(vfsPath.pData, "/shared", 7) == 0) {
12 builder.Append(vfsPath);
13 }
14 else if (strncmp(vfsPath.pData, "/app", 4) == 0) {
15 builder.Append(Cpu::GetAppName());
16 builder.Append(vfsPath.pData + 4);
17 }
18 else {
19 return false;
20 }
21 }
22 // relative path, so make it relative to the app's location
23 else {
24 builder.Append(Cpu::GetAppName());
25 builder.Append("/");
26 builder.Append(vfsPath);
27 }
28
29 outRealPath = builder.CreateString(pArena);
30 return true;
31}
32
33// ***********************************************************************
34

Callers 8

resolveModuleMethod · 0.85
LuaIncludeFunction · 0.85
VfsStoreFunction · 0.85
VfsLoadFunction · 0.85
VfsMakeDirectoryFunction · 0.85
VfsRemoveFunction · 0.85
VfsCopyFunction · 0.85
VfsMoveFunction · 0.85

Calls 1

GetAppNameFunction · 0.85

Tested by

no test coverage detected