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

Function fxRealFilePath

xs/tools/xslBase.c:647–670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

645}
646
647txString fxRealFilePath(txLinker* linker, txString path)
648{
649#if mxWindows
650 char buffer[C_PATH_MAX];
651 DWORD attributes;
652 if (_fullpath(buffer, path, C_PATH_MAX) != NULL) {
653 attributes = GetFileAttributes(buffer);
654 if ((attributes != 0xFFFFFFFF) && (!(attributes & FILE_ATTRIBUTE_DIRECTORY))) {
655 return fxNewLinkerString(linker, buffer, mxStringLength(buffer));
656 }
657 }
658#else
659 char buffer[C_PATH_MAX];
660 struct stat a_stat;
661 if (realpath(path, buffer) != NULL) {
662 if (stat(buffer, &a_stat) == 0) {
663 if (S_ISREG(a_stat.st_mode)) {
664 return fxNewLinkerString(linker, buffer, mxStringLength(buffer));
665 }
666 }
667 }
668#endif
669 return NULL;
670}
671
672void fxReferenceLinkerSymbol(txLinker* linker, txID id)
673{

Callers

nothing calls this directly

Calls 2

fxNewLinkerStringFunction · 0.85
statClass · 0.70

Tested by

no test coverage detected