MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxCombinePath

Function fxCombinePath

xs/sources/xsScript.c:53–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53txString fxCombinePath(txParser* parser, txString base, txString name)
54{
55 txSize baseLength, nameLength;
56 txString path;
57 txString separator ;
58#if mxWindows
59 separator = name;
60 while (*separator) {
61 if (*separator == '/')
62 *separator = '\\';
63 separator++;
64 }
65 separator = strrchr(base, '\\');
66#else
67 separator = strrchr(base, '/');
68#endif
69 if (separator) {
70 separator++;
71 baseLength = mxPtrDiff(separator - base);
72 }
73 else
74 baseLength = 0;
75 nameLength = mxStringLength(name);
76 path = fxNewParserChunk(parser, baseLength + nameLength + 1);
77 if (baseLength)
78 c_memcpy(path, base, baseLength);
79 c_memcpy(path + baseLength, name, nameLength + 1);
80 return path;
81}
82
83void fxDisposeParserChunks(txParser* parser)
84{

Callers 2

mainFunction · 0.85
fxLoadScriptFunction · 0.85

Calls 1

fxNewParserChunkFunction · 0.85

Tested by

no test coverage detected