path.h File Reference

Path manipulation helper functions. More...

#include "os_port.h"

Go to the source code of this file.

Functions

bool_t pathIsAbsolute (const char_t *path)
 Test if the path is absolute. More...
 
bool_t pathIsRelative (const char_t *path)
 Test if the path is relative. More...
 
const char_tpathGetFilename (const char_t *path)
 Extract the file name from the supplied path. More...
 
void pathRemoveFilename (char_t *path)
 Remove the trailing file name from the supplied path. More...
 
void pathCopy (char_t *dest, const char_t *src, size_t maxLen)
 Copy a path. More...
 
void pathCanonicalize (char_t *path)
 Simplify a path. More...
 
void pathAddSlash (char_t *path, size_t maxLen)
 Add a slash to the end of a string. More...
 
void pathRemoveSlash (char_t *path)
 Remove the trailing slash from a given path. More...
 
void pathCombine (char_t *path, const char_t *more, size_t maxLen)
 Concatenate two paths. More...
 
bool_t pathMatch (const char_t *path, const char_t *pattern)
 Check whether a file name matches the specified pattern. More...
 

Detailed Description

Path manipulation helper functions.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.0

Definition in file path.h.

Function Documentation

◆ pathAddSlash()

void pathAddSlash ( char_t path,
size_t  maxLen 
)

Add a slash to the end of a string.

Parameters
[in,out]pathNULL-terminated string that represents the path
[in]maxLenMaximum pathname length

Definition at line 312 of file path.c.

◆ pathCanonicalize()

void pathCanonicalize ( char_t path)

Simplify a path.

Parameters
[in]pathNULL-terminated string containing the path to be canonicalized

Definition at line 150 of file path.c.

◆ pathCombine()

void pathCombine ( char_t path,
const char_t more,
size_t  maxLen 
)

Concatenate two paths.

Parameters
[in,out]pathNULL-terminated string containing the first path
[in]moreNULL-terminated string containing the second path
[in]maxLenMaximum pathname length

Definition at line 370 of file path.c.

◆ pathCopy()

void pathCopy ( char_t dest,
const char_t src,
size_t  maxLen 
)

Copy a path.

Parameters
[out]destPointer to the destination buffer
[in]srcPointer to the source path
[in]maxLenMaximum pathname length

Definition at line 129 of file path.c.

◆ pathGetFilename()

const char_t* pathGetFilename ( const char_t path)

Extract the file name from the supplied path.

Parameters
[in]pathNULL-terminated string that contains the path
Returns
Pointer to the file name

Definition at line 73 of file path.c.

◆ pathIsAbsolute()

bool_t pathIsAbsolute ( const char_t path)

Test if the path is absolute.

Parameters
[in]pathNULL-terminated string that contains the path
Returns
TRUE is the path is absolute, else FALSE

Definition at line 41 of file path.c.

◆ pathIsRelative()

bool_t pathIsRelative ( const char_t path)

Test if the path is relative.

Parameters
[in]pathNULL-terminated string that contains the path
Returns
TRUE is the path is relative, else FALSE

Definition at line 57 of file path.c.

◆ pathMatch()

bool_t pathMatch ( const char_t path,
const char_t pattern 
)

Check whether a file name matches the specified pattern.

Parameters
[in]pathNULL-terminated string that contains the path to be matched
[in]patternNULL-terminated string that contains the pattern for which to search. The pattern may contain wildcard characters
Returns
TRUE if the path matches the specified pattern, else FALSE

Definition at line 408 of file path.c.

◆ pathRemoveFilename()

void pathRemoveFilename ( char_t path)

Remove the trailing file name from the supplied path.

Parameters
[in]pathNULL-terminated string that contains the path

Definition at line 112 of file path.c.

◆ pathRemoveSlash()

void pathRemoveSlash ( char_t path)

Remove the trailing slash from a given path.

Parameters
[in,out]pathNULL-terminated string that contains the path

Definition at line 340 of file path.c.