> For the complete documentation index, see [llms.txt](https://sandbox-docs.verifone.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sandbox-docs.verifone.com/s-adk-5.1-programmers-guide/readme/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/pathutil_8h.md).

# pathutil.h

[Functions](#func-members)

`#include <string>` `#include <sys/types.h>`

Include dependency graph for pathutil.h:

![](/files/iN9uLUbOPPI7ZsGOrIEM)

This graph shows which files directly or indirectly include this file:

![](/files/ZOQrpBAJCNladmRVSA1j)

[Go to the source code of this file.](/s-adk-5.1-programmers-guide/pathutil_8h_source.md)

|             |                                                                                                |
| ----------- | ---------------------------------------------------------------------------------------------- |
| Functions   |                                                                                                |
| std::string | [pathclean](#aa01a783fcf5ab8dfb3371ddf1937b1d8) (const std::string \&path)                     |
| std::string | [pathcat](#a01bbf38e5df83444a0b653a5424d1471) (const std::string \&p1, const std::string \&p2) |
| void        | [current\_dir](#a5338868628e8af64851c06a4d5672474) (std::string \&cwd)                         |
| bool        | [is\_absolute\_path](#a5f02ed450e4d048f1779afacae02eb47) (const std::string \&path)            |
| std::string | [dirname](#a9181ca7ec40f7d471eb410a1215a2321) (const std::string \&path)                       |
| std::string | [filename\_from\_path](#ad2f12525e3b8ec94ed3a22f8d96ac145) (const std::string \&path)          |
| bool        | [make\_dir](#adc366505b5f6eb4fcf1099dce96fabc6) (const std::string \&path, mode\_t mode=0777)  |

### FunctionDocumentation <a href="#function-documentation" id="function-documentation"></a>

### current\_dir() <a href="#a5338868628e8af64851c06a4d5672474" id="a5338868628e8af64851c06a4d5672474"></a>

void current\_dir

returns the path of current working directory

**Parameters**

\[in,out] **cwd** path to current working directory

### dirname() <a href="#a9181ca7ec40f7d471eb410a1215a2321" id="a9181ca7ec40f7d471eb410a1215a2321"></a>

std::string dirname

strip non-directory suffix from file name

**Parameters**

\[in] **path** file name including path

#### Returns

directory name

{% hint style="info" %}
*path* supports both / and \ as path separator
{% endhint %}

### filename\_from\_path() <a href="#ad2f12525e3b8ec94ed3a22f8d96ac145" id="ad2f12525e3b8ec94ed3a22f8d96ac145"></a>

std::string filename\_from\_path

strip directory prefix from file name

**Parameters**

\[in] **path** file name including path

#### Returns

file name

{% hint style="info" %}
*path* supports both / and \ as path separator
{% endhint %}

### is\_absolute\_path() <a href="#a5f02ed450e4d048f1779afacae02eb47" id="a5f02ed450e4d048f1779afacae02eb47"></a>

bool is\_absolute\_path

returns true, if parameter *path* is an absolute path

**Parameters**

\[in] **path** path name

#### Returns

true for an absolute path, else false

### make\_dir() <a href="#adc366505b5f6eb4fcf1099dce96fabc6" id="adc366505b5f6eb4fcf1099dce96fabc6"></a>

bool make\_dir

create directory and parent directories if required.

**Parameters**

\[in] **path** path to be created \[in] **mode** mode specifies the permissions to use (as used for mkdir())

#### Returns

true if the directory was created or was already existing, false if the directory could not be created

### pathcat() <a href="#a01bbf38e5df83444a0b653a5424d1471" id="a01bbf38e5df83444a0b653a5424d1471"></a>

std::string pathcat

concatenate two path components into a path. It handles also the case that the second component *p2* is an absolute path, e.g. "a" + "/b" -> "/b"

**Parameters**

\[in] **p1** first path component \[in] **p2** second path component

#### Returns

resulting combined path

### pathclean() <a href="#aa01a783fcf5ab8dfb3371ddf1937b1d8" id="aa01a783fcf5ab8dfb3371ddf1937b1d8"></a>

std::string pathclean

cleanup path, examples:

* "a//b" -> "a/b"
* "a/../b" -> "b" **Parameters**

  \[in] **path** path to be cleaned up

  #### Returns

  cleaned up path


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://sandbox-docs.verifone.com/s-adk-5.1-programmers-guide/readme/files/dir_44d926a17fc606d3c25449ba60427c63/dir_048f823fee1bfb22502a8732b9a001aa/pathutil_8h.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
