mirror of https://gitlab.com/nakst/essence
global: rename DirectoryEnumerateChildren to DirectoryEnumerate
This commit is contained in:
parent
b649302fe8
commit
591bb5635d
|
@ -271,7 +271,7 @@ EsError CommandPasteFile(String source, String destinationBase, void **copyBuffe
|
||||||
|
|
||||||
if (error == ES_ERROR_INCORRECT_NODE_TYPE) {
|
if (error == ES_ERROR_INCORRECT_NODE_TYPE) {
|
||||||
uintptr_t childCount;
|
uintptr_t childCount;
|
||||||
EsDirectoryChild *buffer = EsDirectoryEnumerateChildren(STRING(source), &childCount, &error);
|
EsDirectoryChild *buffer = EsDirectoryEnumerate(STRING(source), &childCount, &error);
|
||||||
|
|
||||||
if (error == ES_SUCCESS) {
|
if (error == ES_SUCCESS) {
|
||||||
error = EsPathCreate(STRING(destination), ES_NODE_DIRECTORY, false);
|
error = EsPathCreate(STRING(destination), ES_NODE_DIRECTORY, false);
|
||||||
|
|
|
@ -76,7 +76,7 @@ EsError FSDirEnumerate(Folder *folder) {
|
||||||
|
|
||||||
uintptr_t _entryCount;
|
uintptr_t _entryCount;
|
||||||
EsError error;
|
EsError error;
|
||||||
EsDirectoryChild *buffer = EsDirectoryEnumerateChildren(STRING(folder->path), &_entryCount, &error);
|
EsDirectoryChild *buffer = EsDirectoryEnumerate(STRING(folder->path), &_entryCount, &error);
|
||||||
|
|
||||||
if (error == ES_SUCCESS) {
|
if (error == ES_SUCCESS) {
|
||||||
for (uintptr_t i = 0; i < _entryCount; i++) {
|
for (uintptr_t i = 0; i < _entryCount; i++) {
|
||||||
|
|
|
@ -396,7 +396,7 @@ int External_DirectoryInternalStartIteration(ExecutionContext *context, Value *r
|
||||||
STACK_POP_STRING(entryText, entryBytes);
|
STACK_POP_STRING(entryText, entryBytes);
|
||||||
EsHeapFree(directoryIterationBuffer);
|
EsHeapFree(directoryIterationBuffer);
|
||||||
EsError error;
|
EsError error;
|
||||||
directoryIterationBuffer = EsDirectoryEnumerateChildren(entryText, entryBytes, &directoryIterationBufferCount, &error);
|
directoryIterationBuffer = EsDirectoryEnumerate(entryText, entryBytes, &directoryIterationBufferCount, &error);
|
||||||
directoryIterationBufferPosition = 0;
|
directoryIterationBufferPosition = 0;
|
||||||
if (error == ES_SUCCESS) return EXTCALL_RETURN_ERR_UNMANAGED;
|
if (error == ES_SUCCESS) return EXTCALL_RETURN_ERR_UNMANAGED;
|
||||||
RETURN_ERROR(error);
|
RETURN_ERROR(error);
|
||||||
|
|
|
@ -550,10 +550,10 @@ struct {
|
||||||
|
|
||||||
const int testVariable = 3;
|
const int testVariable = 3;
|
||||||
|
|
||||||
bool DirectoryEnumerateChildrenRecursive(const char *path, size_t pathBytes) {
|
bool DirectoryEnumerateRecursive(const char *path, size_t pathBytes) {
|
||||||
size_t count;
|
size_t count;
|
||||||
EsError error;
|
EsError error;
|
||||||
EsDirectoryChild *buffer = EsDirectoryEnumerateChildren(path, pathBytes, &count, &error);
|
EsDirectoryChild *buffer = EsDirectoryEnumerate(path, pathBytes, &count, &error);
|
||||||
|
|
||||||
if (error != ES_SUCCESS) {
|
if (error != ES_SUCCESS) {
|
||||||
EsPrint("Error %i enumerating at path \"%s\".\n", error, pathBytes, path);
|
EsPrint("Error %i enumerating at path \"%s\".\n", error, pathBytes, path);
|
||||||
|
@ -575,14 +575,14 @@ bool DirectoryEnumerateChildrenRecursive(const char *path, size_t pathBytes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataBytes != (size_t) buffer[i].fileSize) {
|
if (dataBytes != (size_t) buffer[i].fileSize) {
|
||||||
EsPrint("File size mismatch reading path \"%s\" (got %d from EsFileReadAll, got %d from EsDirectoryEnumerateChildren).\n",
|
EsPrint("File size mismatch reading path \"%s\" (got %d from EsFileReadAll, got %d from EsDirectoryEnumerate).\n",
|
||||||
childPathBytes, childPath, dataBytes, buffer[i].fileSize);
|
childPathBytes, childPath, dataBytes, buffer[i].fileSize);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EsHeapFree(data);
|
EsHeapFree(data);
|
||||||
} else if (buffer[i].type == ES_NODE_DIRECTORY) {
|
} else if (buffer[i].type == ES_NODE_DIRECTORY) {
|
||||||
if (!DirectoryEnumerateChildrenRecursive(childPath, childPathBytes)) {
|
if (!DirectoryEnumerateRecursive(childPath, childPathBytes)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -603,7 +603,7 @@ bool OldTests2018() {
|
||||||
CHECK(testStruct.b == 2);
|
CHECK(testStruct.b == 2);
|
||||||
CHECK(testVariable == 3);
|
CHECK(testVariable == 3);
|
||||||
|
|
||||||
CHECK(DirectoryEnumerateChildrenRecursive(EsLiteral("|Settings:")));
|
CHECK(DirectoryEnumerateRecursive(EsLiteral("|Settings:")));
|
||||||
|
|
||||||
for (int count = 16; count < 100; count += 30) {
|
for (int count = 16; count < 100; count += 30) {
|
||||||
EsHandle handles[100];
|
EsHandle handles[100];
|
||||||
|
@ -647,7 +647,7 @@ bool OldTests2018() {
|
||||||
CHECK(EsPathExists(EsLiteral("|Settings:/a.txt")));
|
CHECK(EsPathExists(EsLiteral("|Settings:/a.txt")));
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK(DirectoryEnumerateChildrenRecursive(EsLiteral("|Settings:")));
|
CHECK(DirectoryEnumerateRecursive(EsLiteral("|Settings:")));
|
||||||
|
|
||||||
{
|
{
|
||||||
void *a = EsCRTmalloc(0x100000);
|
void *a = EsCRTmalloc(0x100000);
|
||||||
|
|
|
@ -98,12 +98,12 @@ EsError EsFileControl(EsHandle file, uint32_t flags) {
|
||||||
return EsSyscall(ES_SYSCALL_FILE_CONTROL, file, flags, 0, 0);
|
return EsSyscall(ES_SYSCALL_FILE_CONTROL, file, flags, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ptrdiff_t DirectoryEnumerateChildrenFromHandle(EsHandle directory, EsDirectoryChild *buffer, size_t size) {
|
ptrdiff_t DirectoryEnumerateFromHandle(EsHandle directory, EsDirectoryChild *buffer, size_t size) {
|
||||||
if (!size) return 0;
|
if (!size) return 0;
|
||||||
return EsSyscall(ES_SYSCALL_DIRECTORY_ENUMERATE, directory, (uintptr_t) buffer, size, 0);
|
return EsSyscall(ES_SYSCALL_DIRECTORY_ENUMERATE, directory, (uintptr_t) buffer, size, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EsDirectoryChild *EsDirectoryEnumerateChildren(const char *path, ptrdiff_t pathBytes, size_t *countOut, EsError *errorOut) {
|
EsDirectoryChild *EsDirectoryEnumerate(const char *path, ptrdiff_t pathBytes, size_t *countOut, EsError *errorOut) {
|
||||||
*countOut = 0;
|
*countOut = 0;
|
||||||
*errorOut = ES_ERROR_UNKNOWN;
|
*errorOut = ES_ERROR_UNKNOWN;
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ EsDirectoryChild *EsDirectoryEnumerateChildren(const char *path, ptrdiff_t pathB
|
||||||
EsDirectoryChild *buffer = (EsDirectoryChild *) EsHeapAllocate(sizeof(EsDirectoryChild) * node.directoryChildren, true);
|
EsDirectoryChild *buffer = (EsDirectoryChild *) EsHeapAllocate(sizeof(EsDirectoryChild) * node.directoryChildren, true);
|
||||||
|
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
ptrdiff_t result = DirectoryEnumerateChildrenFromHandle(node.handle, buffer, node.directoryChildren);
|
ptrdiff_t result = DirectoryEnumerateFromHandle(node.handle, buffer, node.directoryChildren);
|
||||||
|
|
||||||
if (ES_CHECK_ERROR(result)) {
|
if (ES_CHECK_ERROR(result)) {
|
||||||
EsHeapFree(buffer);
|
EsHeapFree(buffer);
|
||||||
|
|
|
@ -2126,7 +2126,7 @@ function void EsINIZeroTerminate(EsINIState *s);
|
||||||
|
|
||||||
function const void *EsBundleFind(const EsBundle *bundle, STRING name, size_t *byteCount = ES_NULL) @out(byteCount) @fixed_buffer_out(return, byteCount*); // Pass null as the bundle to use the current application's bundle.
|
function const void *EsBundleFind(const EsBundle *bundle, STRING name, size_t *byteCount = ES_NULL) @out(byteCount) @fixed_buffer_out(return, byteCount*); // Pass null as the bundle to use the current application's bundle.
|
||||||
|
|
||||||
function EsDirectoryChild *EsDirectoryEnumerateChildren(STRING path, size_t *count, EsError *error = ES_NULL) @out(count) @out(error) @heap_array_out(return, count*);
|
function EsDirectoryChild *EsDirectoryEnumerate(STRING path, size_t *count, EsError *error = ES_NULL) @out(count) @out(error) @heap_array_out(return, count*);
|
||||||
|
|
||||||
function void *EsFileReadAll(STRING filePath, size_t *fileSize, EsError *error = ES_NULL) @out(fileSize) @out(error) @heap_buffer_out(return, fileSize*); // Free with EsHeapFree.
|
function void *EsFileReadAll(STRING filePath, size_t *fileSize, EsError *error = ES_NULL) @out(fileSize) @out(error) @heap_buffer_out(return, fileSize*); // Free with EsHeapFree.
|
||||||
function void *EsFileReadAllFromHandle(EsHandle handle, size_t *fileSize, EsError *error = ES_NULL) @out(fileSize) @out(error) @heap_buffer_out(return, fileSize*); // Free with EsHeapFree.
|
function void *EsFileReadAllFromHandle(EsHandle handle, size_t *fileSize, EsError *error = ES_NULL) @out(fileSize) @out(error) @heap_buffer_out(return, fileSize*); // Free with EsHeapFree.
|
||||||
|
|
|
@ -66,7 +66,7 @@ void FSNodeCloseHandle(KNode *node, uint32_t flags);
|
||||||
EsError FSNodeDelete(KNode *node);
|
EsError FSNodeDelete(KNode *node);
|
||||||
EsError FSNodeMove(KNode *node, KNode *destination, const char *newName, size_t nameNameBytes);
|
EsError FSNodeMove(KNode *node, KNode *destination, const char *newName, size_t nameNameBytes);
|
||||||
EsError FSFileResize(KNode *node, EsFileOffset newSizeBytes);
|
EsError FSFileResize(KNode *node, EsFileOffset newSizeBytes);
|
||||||
ptrdiff_t FSDirectoryEnumerateChildren(KNode *node, K_USER_BUFFER EsDirectoryChild *buffer, size_t bufferSize);
|
ptrdiff_t FSDirectoryEnumerate(KNode *node, K_USER_BUFFER EsDirectoryChild *buffer, size_t bufferSize);
|
||||||
EsError FSFileControl(KNode *node, uint32_t flags);
|
EsError FSFileControl(KNode *node, uint32_t flags);
|
||||||
bool FSTrimCachedNode(MMObjectCache *);
|
bool FSTrimCachedNode(MMObjectCache *);
|
||||||
bool FSTrimCachedDirectoryEntry(MMObjectCache *);
|
bool FSTrimCachedDirectoryEntry(MMObjectCache *);
|
||||||
|
@ -650,7 +650,7 @@ EsError FSNodeMove(KNode *node, KNode *_newParent, const char *newName, size_t n
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _FSDirectoryEnumerateChildrenVisit(AVLItem<FSDirectoryEntry> *item, K_USER_BUFFER EsDirectoryChild *buffer, size_t bufferSize, uintptr_t *position) {
|
void _FSDirectoryEnumerateVisit(AVLItem<FSDirectoryEntry> *item, K_USER_BUFFER EsDirectoryChild *buffer, size_t bufferSize, uintptr_t *position) {
|
||||||
if (!item || *position == bufferSize) {
|
if (!item || *position == bufferSize) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -660,7 +660,7 @@ void _FSDirectoryEnumerateChildrenVisit(AVLItem<FSDirectoryEntry> *item, K_USER_
|
||||||
*position = *position + 1;
|
*position = *position + 1;
|
||||||
|
|
||||||
if (entry->node && (entry->node->flags & NODE_DELETED)) {
|
if (entry->node && (entry->node->flags & NODE_DELETED)) {
|
||||||
KernelPanic("_FSDirectoryEnumerateChildrenVisit - Deleted node %x found in directory tree.\n");
|
KernelPanic("_FSDirectoryEnumerateVisit - Deleted node %x found in directory tree.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t nameBytes = entry->item.key.longKeyBytes > ES_MAX_DIRECTORY_CHILD_NAME_LENGTH ? ES_MAX_DIRECTORY_CHILD_NAME_LENGTH : entry->item.key.longKeyBytes;
|
size_t nameBytes = entry->item.key.longKeyBytes > ES_MAX_DIRECTORY_CHILD_NAME_LENGTH ? ES_MAX_DIRECTORY_CHILD_NAME_LENGTH : entry->item.key.longKeyBytes;
|
||||||
|
@ -670,15 +670,15 @@ void _FSDirectoryEnumerateChildrenVisit(AVLItem<FSDirectoryEntry> *item, K_USER_
|
||||||
output->directoryChildren = entry->directoryChildren;
|
output->directoryChildren = entry->directoryChildren;
|
||||||
output->nameBytes = nameBytes;
|
output->nameBytes = nameBytes;
|
||||||
|
|
||||||
_FSDirectoryEnumerateChildrenVisit(item->children[0], buffer, bufferSize, position);
|
_FSDirectoryEnumerateVisit(item->children[0], buffer, bufferSize, position);
|
||||||
_FSDirectoryEnumerateChildrenVisit(item->children[1], buffer, bufferSize, position);
|
_FSDirectoryEnumerateVisit(item->children[1], buffer, bufferSize, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
ptrdiff_t FSDirectoryEnumerateChildren(KNode *node, K_USER_BUFFER EsDirectoryChild *buffer, size_t bufferSize) {
|
ptrdiff_t FSDirectoryEnumerate(KNode *node, K_USER_BUFFER EsDirectoryChild *buffer, size_t bufferSize) {
|
||||||
// uint64_t start = ProcessorReadTimeStamp();
|
// uint64_t start = ProcessorReadTimeStamp();
|
||||||
|
|
||||||
if (node->directoryEntry->type != ES_NODE_DIRECTORY) {
|
if (node->directoryEntry->type != ES_NODE_DIRECTORY) {
|
||||||
KernelPanic("FSDirectoryEnumerateChildren - Node %x is not a directory.\n", node);
|
KernelPanic("FSDirectoryEnumerate - Node %x is not a directory.\n", node);
|
||||||
}
|
}
|
||||||
|
|
||||||
FSDirectory *directory = (FSDirectory *) node;
|
FSDirectory *directory = (FSDirectory *) node;
|
||||||
|
@ -699,12 +699,12 @@ ptrdiff_t FSDirectoryEnumerateChildren(KNode *node, K_USER_BUFFER EsDirectoryChi
|
||||||
}
|
}
|
||||||
|
|
||||||
uintptr_t position = 0;
|
uintptr_t position = 0;
|
||||||
_FSDirectoryEnumerateChildrenVisit(directory->entries.root, buffer, bufferSize, &position);
|
_FSDirectoryEnumerateVisit(directory->entries.root, buffer, bufferSize, &position);
|
||||||
|
|
||||||
KWriterLockReturn(&directory->writerLock, K_LOCK_EXCLUSIVE);
|
KWriterLockReturn(&directory->writerLock, K_LOCK_EXCLUSIVE);
|
||||||
|
|
||||||
// uint64_t end = ProcessorReadTimeStamp();
|
// uint64_t end = ProcessorReadTimeStamp();
|
||||||
// EsPrint("FSDirectoryEnumerateChildren took %dmcs for %d items.\n", (end - start) / KGetTimeStampTicksPerUs(), position);
|
// EsPrint("FSDirectoryEnumerate took %dmcs for %d items.\n", (end - start) / KGetTimeStampTicksPerUs(), position);
|
||||||
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
|
@ -707,7 +707,7 @@ namespace POSIX {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t count = FSDirectoryEnumerateChildren(file->node, buffer, bufferSize);
|
size_t count = FSDirectoryEnumerate(file->node, buffer, bufferSize);
|
||||||
|
|
||||||
if (ES_CHECK_ERROR(count)) {
|
if (ES_CHECK_ERROR(count)) {
|
||||||
EsHeapFree(buffer, sizeof(EsDirectoryChild) * bufferSize, K_FIXED);
|
EsHeapFree(buffer, sizeof(EsDirectoryChild) * bufferSize, K_FIXED);
|
||||||
|
|
|
@ -1183,7 +1183,7 @@ SYSCALL_IMPLEMENT(ES_SYSCALL_DIRECTORY_ENUMERATE) {
|
||||||
if (argument2 > SYSCALL_BUFFER_LIMIT / sizeof(EsDirectoryChild)) SYSCALL_RETURN(ES_FATAL_ERROR_INVALID_BUFFER, true);
|
if (argument2 > SYSCALL_BUFFER_LIMIT / sizeof(EsDirectoryChild)) SYSCALL_RETURN(ES_FATAL_ERROR_INVALID_BUFFER, true);
|
||||||
SYSCALL_BUFFER(argument1, argument2 * sizeof(EsDirectoryChild), 1, true /* write */);
|
SYSCALL_BUFFER(argument1, argument2 * sizeof(EsDirectoryChild), 1, true /* write */);
|
||||||
|
|
||||||
SYSCALL_RETURN(FSDirectoryEnumerateChildren(node, (K_USER_BUFFER EsDirectoryChild *) argument1, argument2), false);
|
SYSCALL_RETURN(FSDirectoryEnumerate(node, (K_USER_BUFFER EsDirectoryChild *) argument1, argument2), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSCALL_IMPLEMENT(ES_SYSCALL_FILE_CONTROL) {
|
SYSCALL_IMPLEMENT(ES_SYSCALL_FILE_CONTROL) {
|
||||||
|
|
|
@ -37,7 +37,6 @@ EsCommandSetCheck=35
|
||||||
EsTextboxGetContentsAsDouble=36
|
EsTextboxGetContentsAsDouble=36
|
||||||
EsFileStoreAppend=37
|
EsFileStoreAppend=37
|
||||||
EsBufferFlushToFileStore=38
|
EsBufferFlushToFileStore=38
|
||||||
EsDirectoryEnumerateChildren=39
|
|
||||||
EsPathExists=40
|
EsPathExists=40
|
||||||
EsInstanceSetClassViewer=41
|
EsInstanceSetClassViewer=41
|
||||||
EsPathDelete=42
|
EsPathDelete=42
|
||||||
|
@ -494,3 +493,4 @@ DateToLinear=492
|
||||||
EsRectangleContainsAll=493
|
EsRectangleContainsAll=493
|
||||||
EsListViewFixedItemSetEnumStringsForColumn=494
|
EsListViewFixedItemSetEnumStringsForColumn=494
|
||||||
EsImageDisplayGetImageHeight=495
|
EsImageDisplayGetImageHeight=495
|
||||||
|
EsDirectoryEnumerate=496
|
||||||
|
|
|
@ -414,7 +414,7 @@ void CreateImportNode(const char *path, ImportNode *node) {
|
||||||
char *path2 = EsPOSIXConvertPath(path, &path2Bytes, true);
|
char *path2 = EsPOSIXConvertPath(path, &path2Bytes, true);
|
||||||
EsError error;
|
EsError error;
|
||||||
uintptr_t childCount;
|
uintptr_t childCount;
|
||||||
EsDirectoryChild *children = EsDirectoryEnumerateChildren(path2, path2Bytes, &childCount, &error);
|
EsDirectoryChild *children = EsDirectoryEnumerate(path2, path2Bytes, &childCount, &error);
|
||||||
EsAssert(error == ES_SUCCESS);
|
EsAssert(error == ES_SUCCESS);
|
||||||
EsHeapFree(path2, 0, NULL);
|
EsHeapFree(path2, 0, NULL);
|
||||||
|
|
||||||
|
|
|
@ -490,7 +490,7 @@ void *LibraryGetAddress(void *library, const char *name);
|
||||||
char baseModuleSource[] = {
|
char baseModuleSource[] = {
|
||||||
// TODO Temporary.
|
// TODO Temporary.
|
||||||
"struct DirectoryChild { str name; bool isDirectory; int size; };"
|
"struct DirectoryChild { str name; bool isDirectory; int size; };"
|
||||||
"DirectoryChild[] Dir() { str[] names = DirectoryEnumerateChildren(\"0:\"):assert(); DirectoryChild[] result = new DirectoryChild[]; result:resize(names:len()); for int i = 0; i < names:len(); i += 1 { result[i] = new DirectoryChild; result[i].name = names[i]; result[i].isDirectory = PathIsDirectory(\"0:/\"+names[i]); result[i].size = FileGetSize(\"0:/\"+names[i]):default(-1); } return result;}"
|
"DirectoryChild[] Dir() { str[] names = DirectoryEnumerate(\"0:\"):assert(); DirectoryChild[] result = new DirectoryChild[]; result:resize(names:len()); for int i = 0; i < names:len(); i += 1 { result[i] = new DirectoryChild; result[i].name = names[i]; result[i].isDirectory = PathIsDirectory(\"0:/\"+names[i]); result[i].size = FileGetSize(\"0:/\"+names[i]):default(-1); } return result;}"
|
||||||
"str[] OpenDocumentEnumerate() #extcall;"
|
"str[] OpenDocumentEnumerate() #extcall;"
|
||||||
|
|
||||||
// Logging:
|
// Logging:
|
||||||
|
@ -621,12 +621,12 @@ char baseModuleSource[] = {
|
||||||
" }"
|
" }"
|
||||||
" return #success;"
|
" return #success;"
|
||||||
"}"
|
"}"
|
||||||
"err[str[]] DirectoryEnumerateChildren(str path) {"
|
"err[str[]] DirectoryEnumerate(str path) {"
|
||||||
" str[] result = new str[];"
|
" str[] result = new str[];"
|
||||||
" err[void] e = _DirectoryInternalEnumerateChildren(path, \"\", result, false);"
|
" err[void] e = _DirectoryInternalEnumerateChildren(path, \"\", result, false);"
|
||||||
" reterr e; return result;"
|
" reterr e; return result;"
|
||||||
"}"
|
"}"
|
||||||
"err[str[]] DirectoryEnumerateChildrenRecursively(str path) {"
|
"err[str[]] DirectoryEnumerateRecursively(str path) {"
|
||||||
" str[] result = new str[];"
|
" str[] result = new str[];"
|
||||||
" err[void] e = _DirectoryInternalEnumerateChildren(PathTrimTrailingSlash(path), \"\", result, true);"
|
" err[void] e = _DirectoryInternalEnumerateChildren(PathTrimTrailingSlash(path), \"\", result, true);"
|
||||||
" reterr e; return result;"
|
" reterr e; return result;"
|
||||||
|
@ -635,7 +635,7 @@ char baseModuleSource[] = {
|
||||||
"str PathTrimTrailingSlash(str x) { if x:len() > 0 && x[x:len() - 1] == \"/\" { return StringSlice(x, 0, x:len() - 1); } return x; }"
|
"str PathTrimTrailingSlash(str x) { if x:len() > 0 && x[x:len() - 1] == \"/\" { return StringSlice(x, 0, x:len() - 1); } return x; }"
|
||||||
|
|
||||||
"err[void] PathDeleteRecursively(str path) {"
|
"err[void] PathDeleteRecursively(str path) {"
|
||||||
" err[str[]] e = DirectoryEnumerateChildrenRecursively(path);"
|
" err[str[]] e = DirectoryEnumerateRecursively(path);"
|
||||||
" if str[] all in e {"
|
" if str[] all in e {"
|
||||||
" for int i = 0; i < all:len(); i += 1 {"
|
" for int i = 0; i < all:len(); i += 1 {"
|
||||||
" str p = path + \"/\" + all[i];"
|
" str p = path + \"/\" + all[i];"
|
||||||
|
@ -655,7 +655,7 @@ char baseModuleSource[] = {
|
||||||
" }"
|
" }"
|
||||||
"}"
|
"}"
|
||||||
"err[void] PathCopyRecursively(str source, str destination) {"
|
"err[void] PathCopyRecursively(str source, str destination) {"
|
||||||
" err[str[]] e = DirectoryEnumerateChildrenRecursively(source);"
|
" err[str[]] e = DirectoryEnumerateRecursively(source);"
|
||||||
" if str[] all in e {"
|
" if str[] all in e {"
|
||||||
" reterr PathCreateDirectory(destination);"
|
" reterr PathCreateDirectory(destination);"
|
||||||
" for int i = 0; i < all:len(); i += 1 {"
|
" for int i = 0; i < all:len(); i += 1 {"
|
||||||
|
@ -691,8 +691,8 @@ char baseModuleSource[] = {
|
||||||
"err[void] PathCopyFilteredInto(str sourceDirectory, str[] filter, int filterWildcard, str destinationDirectory) {"
|
"err[void] PathCopyFilteredInto(str sourceDirectory, str[] filter, int filterWildcard, str destinationDirectory) {"
|
||||||
" assert filter:len() > 0;"
|
" assert filter:len() > 0;"
|
||||||
" err[str[]] e;"
|
" err[str[]] e;"
|
||||||
" if filterWildcard != -1 || filter:len() > 1 { e = DirectoryEnumerateChildrenRecursively(sourceDirectory); }"
|
" if filterWildcard != -1 || filter:len() > 1 { e = DirectoryEnumerateRecursively(sourceDirectory); }"
|
||||||
" else { e = DirectoryEnumerateChildren(sourceDirectory); }"
|
" else { e = DirectoryEnumerate(sourceDirectory); }"
|
||||||
" if str[] items in e {"
|
" if str[] items in e {"
|
||||||
" for int i = 0; i < items:len(); i += 1 {"
|
" for int i = 0; i < items:len(); i += 1 {"
|
||||||
" if PathMatchesFilter(items[i], filter, filterWildcard) {"
|
" if PathMatchesFilter(items[i], filter, filterWildcard) {"
|
||||||
|
|
|
@ -84,7 +84,7 @@ void GenerateAPISamples() {
|
||||||
str sourceFolder = "apps/samples/";
|
str sourceFolder = "apps/samples/";
|
||||||
str destinationFolder = "root/API Samples/";
|
str destinationFolder = "root/API Samples/";
|
||||||
|
|
||||||
for str configFile in DirectoryEnumerateChildren(sourceFolder):assert() {
|
for str configFile in DirectoryEnumerate(sourceFolder):assert() {
|
||||||
if StringEndsWith(configFile, ".ini") {
|
if StringEndsWith(configFile, ".ini") {
|
||||||
str[] config = StringSplitByCharacter(FileReadAll(sourceFolder + configFile):assert(), "\n", false);
|
str[] config = StringSplitByCharacter(FileReadAll(sourceFolder + configFile):assert(), "\n", false);
|
||||||
str sourceFile;
|
str sourceFile;
|
||||||
|
|
Loading…
Reference in New Issue