Jetson Inference
DNN Vision Library
filesystem.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef __FILESYSTEM_UTIL_H__
24 #define __FILESYSTEM_UTIL_H__
25 
26 #include <string>
27 #include <vector>
28 
29 
30 
41 std::string absolutePath( const std::string& relative_path );
42 
43 
54 //bool listDirectory( const char* path, std::vector<std::string>& list, bool includePath=false );
55 
56 
68 std::string locateFile( const std::string& path );
69 
79 std::string locateFile( const std::string& path, std::vector<std::string>& locations );
80 
81 
94 bool fileExists( const char* path, bool regularFilesOnly=false );
95 
96 
106 size_t fileSize( const char* path );
107 
108 
114 std::string filePath( const std::string& filename );
115 
116 
123 std::string fileExtension( const std::string& path );
124 
125 
132 std::string fileRemoveExtension( const std::string& filename );
133 
134 
141 std::string fileChangeExtension( const std::string& filename, const std::string& newExtension );
142 
143 
149 std::string processPath();
150 
151 
162 std::string processDirectory();
163 
164 
169 std::string workingDirectory();
170 
171 
172 #endif
173 
std::string fileRemoveExtension(const std::string &filename)
Return the input string with the file extension removed For example, strRemoveExtension("~/user/somef...
std::string processDirectory()
Return the directory that the calling process resides in.
std::string filePath(const std::string &filename)
Extract the path out of the supplied string, removing the filename and extension For example...
std::string fileChangeExtension(const std::string &filename, const std::string &newExtension)
Return the input string with a changed file extension For example, strChangeExtension("~/user/somefil...
bool fileExists(const char *path, bool regularFilesOnly=false)
Verify path and return true if the file exists.
size_t fileSize(const char *path)
Return the size (in bytes) of the specified file.
std::string absolutePath(const std::string &relative_path)
Given a relative path, resolve the absolute path based on the location of the process that calls the ...
std::string workingDirectory()
Return the current working directory of the calling process.
std::string processPath()
Return the absolute path that of the calling process executable, include the process executable&#39;s fil...
std::string fileExtension(const std::string &path)
Extract the file extension from the path.
std::string locateFile(const std::string &path)
Return a list of all the files in the specified directory.