createDir static method

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

Creates the directory if it doesn't exist. Does not create intermediate directories if they do not exist - see Fs.createDirAll.

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> createDir(Path path) async {
  return await Fs.ioGuard(() async => Directory(path.asString()).create())
      .map((_) => ());
}