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

Function fxRealFilePath

xs/tools/xsid.c:59–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59txString fxRealFilePath(txString path, txString buffer)
60{
61#if mxWindows
62 DWORD attributes;
63 if (_fullpath(buffer, path, C_PATH_MAX) != NULL) {
64 attributes = GetFileAttributes(buffer);
65 if ((attributes != 0xFFFFFFFF) && (!(attributes & FILE_ATTRIBUTE_DIRECTORY))) {
66 return buffer;
67 }
68 }
69#else
70 struct stat a_stat;
71 if (realpath(path, buffer) != NULL) {
72 if (stat(buffer, &a_stat) == 0) {
73 if (S_ISREG(a_stat.st_mode)) {
74 return buffer;
75 }
76 }
77 }
78#endif
79 return NULL;
80}
81
82void fxAbort(void* console, int status)
83{

Callers 1

mainFunction · 0.70

Calls 1

statClass · 0.70

Tested by

no test coverage detected