| 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); |