[fs.path.fmt.cvt]

# 31 Input/output library [[input.output]](./#input.output)

## 31.12 File systems [[filesystems]](filesystems#fs.path.fmt.cvt)

### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.fmt.cvt)

#### 31.12.6.3 Conversions [[fs.path.cvt]](fs.path.cvt#fs.path.fmt.cvt)

#### 31.12.6.3.1 Argument format conversions [fs.path.fmt.cvt]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13935)

[*Note [1](#note-1)*:

The format conversions described in this subclause
are not applied on POSIX-based operating systems
because on these systems:

- [(1.1)](#1.1)

  The generic format is acceptable as a native path[.](#1.1.sentence-1)

- [(1.2)](#1.2)

  There is no need to distinguish between native format and generic format in function arguments[.](#1.2.sentence-1)

- [(1.3)](#1.3)

  Paths for regular files and paths for directories share the same syntax[.](#1.3.sentence-1)

â *end note*]

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13947)

Several functions are defined to accept [*detected-format*](#def:detected-format) arguments,
which are character sequences[.](#2.sentence-1)

A detected-format argument represents a path
using either a pathname in the generic format ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format"))
or a pathname in the native format ([[fs.class.path]](fs.class.path "31.12.6 Class path"))[.](#2.sentence-2)

Such an argument is taken to be in the generic format if and only if
it matches the generic format and is not acceptable to the operating system
as a native path[.](#2.sentence-3)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13956)

[*Note [2](#note-2)*:

Some operating systems have no unambiguous way to distinguish between native format and generic format arguments[.](#3.sentence-1)

This is by design as it simplifies use for operating systems that do not require
disambiguation[.](#3.sentence-2)

It is possible that an implementation for an operating system
where disambiguation is needed distinguishes between the formats[.](#3.sentence-3)

â *end note*]

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13964)

Pathnames are converted as needed between the generic and native formats
in an operating-system-dependent manner[.](#4.sentence-1)

Let *G(n)* and *N(g)* in a mathematical sense
be the implementation's functions that convert native-to-generic
and generic-to-native formats respectively[.](#4.sentence-2)

If *g=G(n)* for some *n*, then *G(N(g))=g*;
if *n=N(g)* for some *g*, then *N(G(n))=n*[.](#4.sentence-3)

[*Note [3](#note-3)*:

Neither *G* nor *N* need be invertible[.](#4.sentence-4)

â *end note*]

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13976)

If the native format requires paths for regular files to be formatted
differently from paths for directories, the path shall be treated as a directory
path if its last element is a [*directory-separator*](fs.path.generic#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]"),
otherwise it shall be treated as a path to a regular file[.](#5.sentence-1)

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13982)

[*Note [4](#note-4)*:

A path stores a native format pathname ([[fs.path.native.obs]](fs.path.native.obs "31.12.6.5.6 Native format observers"))
and acts as if it also stores a generic format pathname,
related as given below[.](#6.sentence-1)

The implementation can generate the generic format pathname
based on the native format pathname (and possibly other information)
when requested[.](#6.sentence-2)

â *end note*]

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13992)

When a path is constructed from or is assigned a single representation
separate from any path, the other representation is selected
by the appropriate conversion function (*G* or *N*)[.](#7.sentence-1)

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13997)

When the (new) value *p* of one representation of a path
is derived from the representation of that or another path,
a value *q* is chosen for the other representation[.](#8.sentence-1)

The value *q* converts to *p* (by *G* or *N* as appropriate)
if any such value does so;*q* is otherwise unspecified[.](#8.sentence-2)

[*Note [5](#note-5)*:

If *q* is the result of converting any path at all,
it is the result of converting *p*[.](#8.sentence-3)

â *end note*]
