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

Function fxNewLinkerResource

xs/tools/xslBase.c:434–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434txLinkerResource* fxNewLinkerResource(txLinker* linker, txString path, FILE** fileAddress)
435{
436 txLinkerResource* result = fxNewLinkerChunkClear(linker, sizeof(txLinkerResource));
437 FILE* aFile = NULL;
438 result->path = fxNewLinkerString(linker, path, mxStringLength(path));
439 aFile = fopen(path, "rb");
440 mxThrowElse(aFile);
441 *fileAddress = aFile;
442 fseek(aFile, 0, SEEK_END);
443 result->dataSize = ftell(aFile);
444 fseek(aFile, 0, SEEK_SET);
445 result->dataBuffer = fxNewLinkerChunk(linker, result->dataSize);;
446 mxThrowElse(fread(result->dataBuffer, result->dataSize, 1, aFile) == 1);
447 fclose(aFile);
448 *fileAddress = NULL;
449 return result;
450}
451
452txLinkerScript* fxNewLinkerScript(txLinker* linker, txString path, FILE** fileAddress)
453{

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls 3

fxNewLinkerChunkClearFunction · 0.85
fxNewLinkerStringFunction · 0.85
fxNewLinkerChunkFunction · 0.85

Tested by

no test coverage detected