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