createDirAll static method

FutureResult<(), IoError> createDirAll(
  1. Path path
)

Creates the directory if it doesn't exist. Will create all non-existing path components.

Returns a Ok if the directory was created. Otherwise, if the directory cannot be created the future completes with an Err of IoError.

Implementation

static FutureResult<(), IoError> createDirAll(Path path) async {
  return await Fs.ioGuard(
          () async => Directory(path.asString()).create(recursive: true))
      .map((_) => ());
}