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

Function fxRealDirectoryPath

xs/tools/xslBase.c:620–645  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

618}
619
620txString fxRealDirectoryPath(txLinker* linker, txString path)
621{
622#if mxWindows
623 char buffer[C_PATH_MAX];
624 DWORD attributes;
625 if (_fullpath(buffer, path, C_PATH_MAX) != NULL) {
626 attributes = GetFileAttributes(buffer);
627 if ((attributes != 0xFFFFFFFF) && (attributes & FILE_ATTRIBUTE_DIRECTORY)) {
628 strcat(buffer, "\\");
629 return fxNewLinkerString(linker, buffer, mxStringLength(buffer));
630 }
631 }
632#else
633 char buffer[C_PATH_MAX];
634 struct stat a_stat;
635 if (realpath(path, buffer) != NULL) {
636 if (stat(buffer, &a_stat) == 0) {
637 if (S_ISDIR(a_stat.st_mode)) {
638 strcat(buffer, "/");
639 return fxNewLinkerString(linker, buffer, mxStringLength(buffer));
640 }
641 }
642 }
643#endif
644 return NULL;
645}
646
647txString fxRealFilePath(txLinker* linker, txString path)
648{

Callers

nothing calls this directly

Calls 2

fxNewLinkerStringFunction · 0.85
statClass · 0.70

Tested by

no test coverage detected