CARLA
FileSystem.h
Go to the documentation of this file.
1 // Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #pragma once
8 
9 #include <string>
10 #include <vector>
11 
12 namespace carla {
13 
14  /// Static functions for accessing the file system.
15  ///
16  /// @warning Using this file requires linking against boost_filesystem.
17  class FileSystem {
18  public:
19 
20  /// Convenient function to validate a path before creating a file.
21  ///
22  /// 1) Ensures all the parent directories are created if missing.
23  /// 2) If @a filepath is missing the extension, @a default_extension is
24  /// appended to the path.
25  static void ValidateFilePath(
26  std::string &filepath,
27  const std::string &default_extension = "");
28 
29  /// List (not recursively) regular files at @a folder_path matching
30  /// @a wildcard_pattern.
31  ///
32  /// @throw std::invalid_argument if folder does not exist.
33  ///
34  /// @todo Do permission check.
35  static std::vector<std::string> ListFolder(
36  const std::string &folder_path,
37  const std::string &wildcard_pattern);
38  };
39 
40 } // namespace carla
static void ValidateFilePath(std::string &filepath, const std::string &default_extension="")
Convenient function to validate a path before creating a file.
Definition: FileSystem.cpp:18
Static functions for accessing the file system.
Definition: FileSystem.h:17
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:99
static std::vector< std::string > ListFolder(const std::string &folder_path, const std::string &wildcard_pattern)
List (not recursively) regular files at folder_path matching wildcard_pattern.
Definition: FileSystem.cpp:33