path.h
Go to the documentation of this file.
1 /**
2  * @file path.h
3  * @brief Path manipulation helper functions
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2020 Oryx Embedded SARL. All rights reserved.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.8
27  **/
28 
29 #ifndef _PATH_H
30 #define _PATH_H
31 
32 //Dependencies
33 #include "os_port.h"
34 
35 //C++ guard
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 //Path manipulation helper functions
41 bool_t pathIsAbsolute(const char_t *path);
42 bool_t pathIsRelative(const char_t *path);
43 
44 const char_t *pathFindFileName(const char_t *path);
45 
46 void pathCanonicalize(char_t *path);
47 
48 void pathAddSlash(char_t *path, size_t maxLen);
49 void pathRemoveSlash(char_t *path);
50 
51 void pathCombine(char_t *path, const char_t *more, size_t maxLen);
52 
53 bool_t pathMatch(const char_t *path, const char_t *pattern);
54 
55 //C++ guard
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif
int bool_t
Definition: compiler_port.h:49
void pathRemoveSlash(char_t *path)
Remove the trailing slash from a given path.
Definition: path.c:302
void pathCanonicalize(char_t *path)
Simplify a path.
Definition: path.c:112
bool_t pathMatch(const char_t *path, const char_t *pattern)
Check whether a file name matches the specified pattern.
Definition: path.c:370
void pathAddSlash(char_t *path, size_t maxLen)
Add a slash to the end of a string.
Definition: path.c:274
bool_t pathIsRelative(const char_t *path)
Test if the path is relative.
Definition: path.c:57
char char_t
Definition: compiler_port.h:43
void pathCombine(char_t *path, const char_t *more, size_t maxLen)
Concatenate two paths.
Definition: path.c:332
const char_t * pathFindFileName(const char_t *path)
Search a path for a file name.
Definition: path.c:73
RTOS abstraction layer.
bool_t pathIsAbsolute(const char_t *path)
Test if the path is absolute.
Definition: path.c:41