MCPcopy Create free account
hub / github.com/IoLanguage/io / UArray_appendPath_

Function UArray_appendPath_

libs/basekit/source/UArray_path.c:12–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include <stddef.h>
11
12void UArray_appendPath_(UArray *self, const UArray *path) {
13 const UArray sep = UArray_stackAllocedWithCString_(OS_PATH_SEPARATOR);
14
15 int selfEndsWithSep = IS_PATH_SEPERATOR(UArray_lastLong(self));
16 int pathStartsWithSep = IS_PATH_SEPERATOR(UArray_firstLong(path));
17
18 if (!selfEndsWithSep && !pathStartsWithSep) {
19 if (self->size != 0)
20 UArray_append_(self, &sep);
21 UArray_append_(self, path);
22 } else if (selfEndsWithSep && pathStartsWithSep) {
23 const UArray pathPart = UArray_stackRange(path, 1, path->size - 1);
24 UArray_append_(self, &pathPart);
25 } else {
26 UArray_append_(self, path);
27 }
28}
29
30void UArray_removeLastPathComponent(UArray *self) {
31 long pos = UArray_findLastPathComponent(self);

Callers 3

IoDirectory_justFullPathFunction · 0.85
IoSeq_immutable.cFile · 0.85
IoSeq_mutable.cFile · 0.85

Calls 5

UArray_lastLongFunction · 0.85
UArray_firstLongFunction · 0.85
UArray_append_Function · 0.85
UArray_stackRangeFunction · 0.85

Tested by

no test coverage detected