MCPcopy Index your code
hub / github.com/questdb/questdb / mkdirs

Method mkdirs

core/src/main/java/io/questdb/std/Files.java:350–374  ·  view source on GitHub ↗
(Path path, int mode)

Source from the content-addressed store, hash-verified

348 }
349
350 public static int mkdirs(Path path, int mode) {
351 for (int i = 0, n = path.size(); i < n; i++) {
352 byte b = path.byteAt(i);
353 if (b == Files.SEPARATOR) {
354 // do not attempt to create '/' on linux or 'C:\' on Windows
355 if ((i == 0 && Os.isPosix()) || (i == 2 && Os.isWindows() && path.byteAt(1) == ':')) {
356 continue;
357 }
358
359 // replace separator we just found with \0
360 // temporarily truncate path to the directory we need to create
361 path.$at(i);
362 LPSZ lpsz = path.$();
363 if (path.size() > 0 && !Files.exists(lpsz)) {
364 int r = Files.mkdir(lpsz, mode);
365 if (r != 0) {
366 path.put(i, (byte) Files.SEPARATOR);
367 return r;
368 }
369 }
370 path.put(i, (byte) Files.SEPARATOR);
371 }
372 }
373 return 0;
374 }
375
376 public static long mmap(long fd, long len, long offset, int flags, int memoryTag) {
377 int osFd = fdCache.toOsFd(fd, (flags & MAP_RW) != 0);

Callers 15

createTestPathMethod · 0.95
createTestPathMethod · 0.95
createTestPathMethod · 0.95
testMkdirsMethod · 0.95
createSoftLinkMethod · 0.95
testReportCrashFilesMethod · 0.95
copyDirectoryMethod · 0.95
createTestPathMethod · 0.95
testReservedNameMethod · 0.95

Calls 9

isPosixMethod · 0.95
isWindowsMethod · 0.95
existsMethod · 0.95
mkdirMethod · 0.95
$atMethod · 0.80
sizeMethod · 0.65
byteAtMethod · 0.65
$Method · 0.65
putMethod · 0.65

Tested by 14

createTestPathMethod · 0.76
createTestPathMethod · 0.76
createTestPathMethod · 0.76
testMkdirsMethod · 0.76
createSoftLinkMethod · 0.76
testReportCrashFilesMethod · 0.76
copyDirectoryMethod · 0.76
createTestPathMethod · 0.76
testReservedNameMethod · 0.76