> For the complete documentation index, see [llms.txt](https://ru.gentee.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ru.gentee.org/stdlib/path.md).

# Путь

Здесь описаны функции для работы с путями разделяемых слешами.

* [AbsPath( str path ) str](/stdlib/path.md#abspath-str-path-str)
* [BaseName( str path ) str](/stdlib/path.md#basename-str-path-str)
* [Dir( str path ) str](/stdlib/path.md#dir-str-path-str)
* [Ext( str path ) str](/stdlib/path.md#ext-str-path-str)
* [JoinPath( str path... ) str](/stdlib/path.md#joinpath-str-path-str)
* [MatchPath( str pattern, str path ) bool](/stdlib/path.md#matchpath-str-pattern-str-path-bool)
* [Path( finfo fi ) str](/stdlib/path.md#path-finfo-fi-str)

## Функции

### AbsPath(str path) str

Функция *AbsPath* возвращает абсолютное представление пути.

### BaseName(str path) str

Функция *BaseName* возвращает последний элемент пути. Если есть последний слеш, то он удаляется. Если путь пустой, то возвращается ".".

### Dir(str path) str

Функция *Dir* возвращает путь, исключая последний элемент. Как правило, это путь директории.

### Ext(str path) str

Функция *Ext* возвращает расширение файла. Расширение возвращается без точки.

### JoinPath(str path...) str

Функция *JoinPath* объединяет все указанные пути в один путь, вставляя соответствующий разделитель, где он необходим.

### MatchPath(str pattern, str path) bool

Функция *MatchPath* проверяет, подходит ли данное имя к указанному шаблону. Функция проверяет шаблон полностью для указанного пути, а не для подстроки. Вы можете в качестве шаблона использовать регулярное выражение. Для этого, добавьте в начало и конец символ */*.

* '\*' - любая последовательность, кроме символа разделителя
* '?' - любой одиночный символ, кроме символа разделителя

```
MatchPath(`*.txt`, `myfile.txt`)       // true
MatchPath(`?a?.pdf`, `1ab.pdf`)        // true
MatchPath(`/home/ak/my.pdf`, `*.pdf`)         // false
MatchPath(`/home/ak/my.pdf`, `/home/*/my.*`)  // true
MatchPath(`/user/`, `/home/user/myfile`) // true
```

### Path(finfo fi) str

Функция *Path* объединяет поля *Name* и *Dir* в переменной типа *finfo* и возвращает полученный путь.


---

# 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://ru.gentee.org/stdlib/path.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.
