### Constructor

# Foundry Context new

#### Declaration [src]

    DexFuture*
    foundry_context_new (
      const char* foundry_dir,
      const char* project_dir,
      FoundryContextFlags flags,
      DexCancellable* cancellable
    )

#### Description [src]

Creates a new context.

If `flags` has `FOUNDRY_CONTEXT_FLAGS_CREATE` set then it will create the “.foundry” directory first.

If `project_dir` is not set, the current directory is used unless it was previously stored in the context state.

#### Parameters

`foundry_dir`

  Type: `const char*`

  The “.foundry” directory.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`project_dir`

  Type: `const char*`

  The project root directory.

  The argument can be `NULL`.
  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`flags`

  Type: `FoundryContextFlags`

  Flags for how to create the context.

`cancellable`

  Type: `DexCancellable`

  Optional cancellable to use when awaiting to propagate work cancellation.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

#### Return value

Type: `DexFuture`

A `DexFuture` which will resolve to a `FoundryContext`.

The caller of the function takes ownership of the data, and is responsible for freeing it.