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

Function fxRealDirectoryPath

xs/tools/xsid.c:34–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32static void fxReportError(txString theFormat, ...);
33
34txString fxRealDirectoryPath(txString path, txString buffer)
35{
36#if mxWindows
37 DWORD attributes;
38 if (_fullpath(buffer, path, C_PATH_MAX) != NULL) {
39 attributes = GetFileAttributes(buffer);
40 if ((attributes != 0xFFFFFFFF) && (attributes & FILE_ATTRIBUTE_DIRECTORY)) {
41 strcat(buffer, "\\");
42 return buffer;
43 }
44 }
45#else
46 struct stat a_stat;
47 if (realpath(path, buffer) != NULL) {
48 if (stat(buffer, &a_stat) == 0) {
49 if (S_ISDIR(a_stat.st_mode)) {
50 strcat(buffer, "/");
51 return buffer;
52 }
53 }
54 }
55#endif
56 return NULL;
57}
58
59txString fxRealFilePath(txString path, txString buffer)
60{

Callers 1

mainFunction · 0.70

Calls 1

statClass · 0.70

Tested by

no test coverage detected