| 867 | } |
| 868 | |
| 869 | void fxRunDirectory(txPool* pool, char* path) |
| 870 | { |
| 871 | typedef struct sxEntry txEntry; |
| 872 | struct sxEntry { |
| 873 | txEntry* nextEntry; |
| 874 | char name[1]; |
| 875 | }; |
| 876 | |
| 877 | #if mxWindows |
| 878 | size_t length; |
| 879 | HANDLE findHandle = INVALID_HANDLE_VALUE; |
| 880 | WIN32_FIND_DATA findData; |
| 881 | length = strlen(path); |
| 882 | path[length] = '\\'; |
| 883 | length++; |
| 884 | path[length] = '*'; |
| 885 | path[length + 1] = 0; |
| 886 | findHandle = FindFirstFile(path, &findData); |
| 887 | if (findHandle != INVALID_HANDLE_VALUE) { |
| 888 | txEntry* entry; |
| 889 | txEntry* firstEntry = NULL; |
| 890 | txEntry* nextEntry; |
| 891 | txEntry** address; |
| 892 | do { |
| 893 | if ((findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) || |
| 894 | !strcmp(findData.cFileName, ".") || |
| 895 | !strcmp(findData.cFileName, "..")) |
| 896 | continue; |
| 897 | entry = malloc(sizeof(txEntry) + strlen(findData.cFileName)); |
| 898 | if (!entry) |
| 899 | break; |
| 900 | strcpy(entry->name, findData.cFileName); |
| 901 | address = &firstEntry; |
| 902 | while ((nextEntry = *address)) { |
| 903 | if (strcmp(entry->name, nextEntry->name) < 0) |
| 904 | break; |
| 905 | address = &nextEntry->nextEntry; |
| 906 | } |
| 907 | entry->nextEntry = nextEntry; |
| 908 | *address = entry; |
| 909 | } while (FindNextFile(findHandle, &findData)); |
| 910 | FindClose(findHandle); |
| 911 | while (firstEntry) { |
| 912 | DWORD attributes; |
| 913 | strcpy(path + length, firstEntry->name); |
| 914 | attributes = GetFileAttributes(path); |
| 915 | if (attributes != 0xFFFFFFFF) { |
| 916 | if (attributes & FILE_ATTRIBUTE_DIRECTORY) { |
| 917 | fxPushResult(pool, firstEntry->name); |
| 918 | fxRunDirectory(pool, path); |
| 919 | fxPopResult(pool); |
| 920 | } |
| 921 | else if (fxStringEndsWith(path, ".js") && !fxStringEndsWith(path, "_FIXTURE.js")) |
| 922 | fxRunFile(pool, path); |
| 923 | } |
| 924 | nextEntry = firstEntry->nextEntry; |
| 925 | free(firstEntry); |
| 926 | firstEntry = nextEntry; |
no test coverage detected