> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# File system

A collection of file system utility functions.

## Functions

| Type | Name |
| - | - |
| string | [canonical](#ga8b98a72819aaee1485524b72e2db4eab) (string url="") Tries to convert url, which must exist, to an absolute path that has no symbolic link, dot, or dot-dot elements. |
| | [copyFile](#ga43c0665d078ffe1df1fa55dfe5dbb8d8) (string source\_url, string target\_url) copies the specified file |
| | [createDirectories](#ga15e71a3757e5c445d1853374525bff30) (string url) creates the directory and also subdirectories if required |
| bool | [exists](#ga10d9c7723a9e8f1c4c854ac8618c4b65) (string url) |
| bool | [isDirectory](#ga9cee08428812e33a6b9fbf6bcb93fabf) (string url) |
| bool | [isRegularFile](#ga2056a4fca10b1c0adb916146ad1a51a2) (string url) |
| boost::filesystem::path | [relative](#ga7b396b4263cb6f8d00dd5b0c02dba6c5) (boost::filesystem::path from, boost::filesystem::path to) Get the relative path between two paths. |
| | [removeAll](#ga0f399219011ea9c84280b4b1f95c58d2) (string url) removes the given path and its contents |

## Detailed Description

A collection of file system utility functions.

## Function Documentation

### canonical()

```cpp theme={null}
string canonical(string url = "")
```

Tries to convert url, which must exist, to an absolute path that has no symbolic link, dot, or dot-dot elements.

**Parameters**

| Name | Description |
| - | - |
| url | A string defining the path. This url might be given as absolute or relative path. A relative path starts from the current working directory. For an empty string the current working directory will be assumed |

**Returns**

* On sucess, an absolute path that has no symbolic link, dot, or dot-dot-elements

* If a link, dot or dot-dot resolution lookup failed for some reason, e.g. the url is given in a UNC/URI definition only the absolute path will be returned

**Exceptions**

| Name | Description |
| - | - |
| - | If the url simply not exists |

> [!NOTE]
>
> This is simply an exception safer wrapper of boost::filesystem::canoncial

### copyFile()

```cpp theme={null}
copyFile(
    string source_url,
    string target_url
)
```

copies the specified file

**Parameters**

| Name | Description |
| - | - |
| source\_url | a string defining the path of the source file |
| target\_url | a string defining the path of the target file |

### createDirectories()

```cpp theme={null}
createDirectories(string url)
```

creates the directory and also subdirectories if required

**Parameters**

| Name | Description |
| - | - |
| url | a string defining the path to be created |

### exists()

```cpp theme={null}
bool exists(string url)
```

**Returns**

true if the given url exists

**Parameters**

| Name | Description |
| - | - |
| url | a string defining the path to test |

### isDirectory()

```cpp theme={null}
bool isDirectory(string url)
```

**Returns**

true if the given url is a directory

**Parameters**

| Name | Description |
| - | - |
| url | a string defining the path to test |

### isRegularFile()

```cpp theme={null}
bool isRegularFile(string url)
```

**Returns**

true if the given url is a file

**Parameters**

| Name | Description |
| - | - |
| url | a string defining the path to test |

### relative()

```cpp theme={null}
boost::filesystem::path relative(
    boost::filesystem::path from,
    boost::filesystem::path to
)
```

Get the relative path between two paths.

> [!NOTE]
>
> Works for URLs that are not existing on disk, too.

**Parameters**

| Name | Description |
| - | - |
| from | The origin path |
| to | The target path |

**Returns**

A path object of the relative path.

### removeAll()

```cpp theme={null}
removeAll(string url)
```

removes the given path and its contents

**Parameters**

| Name | Description |
| - | - |
| url | a string defining the path to be deleted |
