# Configuration Directory

{% tabs %}
{% tab title="Creation" %}
Load all files in a directory into one configuration section.

<pre class="language-java"><code class="lang-java">ConfigurationDirectory directory = new ConfigurationDirectory(new File("folder"));
// Load only the directory (true) or all directories inside it too (false).
<strong>directory.load(false);
</strong></code></pre>

{% endtab %}

{% tab title="Getting Values" %}

## Getting values

This is the same as a configuration file.

```java
String value = directory.getString("key");
```

{% endtab %}

{% tab title="Saving Values" %}

## Saving values

```java
// Save to only the directory (true) or all directories inside it too (false).
directory.save(false);
```

1. It will get the **old keys** from **all files**.
2. Loop through **new keys**, if exists save, otherwise save to `lost_keys.yml`.
3. If any **old keys** were missed, delete them.
   {% endtab %}
   {% endtabs %}

***

{% tabs %}
{% tab title="Get Directory" %}

```java
File folder = directory.getDirectory();
File folder = directory.getDirectory("path/path");
```

```java
String name = getDirectoryName();
```

{% endtab %}

{% tab title="Resource/Default Files" %}

```java
directory.addResourcePath("path_from_resource_folder");

List<String> resources = directory.getResourcePathList();
 
directory.removeResourcePath("path_from_resource_folder");

directory.clearResourcePathList();
```

Resource paths will be loaded if the resource doesn't exist in the directory.
{% endtab %}

{% tab title="Datastore" %}

```java
Configuration store = directory.getDataStore();
```

A `YAML` configuration file that can be used to store info about the directory.\
This configuration file won't be loaded as part of the directory.
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://smuddgge.gitbook.io/squishy-library/configuration/configuration-directory.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
