ArmNN
 24.08
Filesystem.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020,2022 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 #if !defined(ARMNN_DISABLE_FILESYSTEM)
8 
9 #if defined(_MSC_VER)
10 // ghc includes Windows.h directly, bringing in macros that we don't want (e.g. min/max).
11 // By including Windows.h ourselves first (with appropriate options), we prevent this.
12 #include <common/include/WindowsWrapper.hpp>
13 #endif
14 #include <ghc/filesystem.hpp>
15 #include <string>
16 
17 namespace fs = ghc::filesystem;
18 
19 namespace armnnUtils
20 {
21 namespace Filesystem
22 {
23 
24 using FileContents = std::string;
25 
26 /// Returns a path to a file in the system temporary folder. If the file existed it will be deleted.
27 fs::path NamedTempFile(const char* fileName);
28 
29 /// Returns full path to temporary folder
30 std::string CreateDirectory(std::string sPath);
31 
32 FileContents ReadFileContentsIntoString(const std::string& path);
33 
34 void RemoveDirectoryAndContents(const std::string& path);
35 
36 } // namespace armnnUtils
37 } // namespace Filesystem
38 
39 #endif // !defined(ARMNN_DISABLE_FILESYSTEM)
armnnUtils::Filesystem::FileContents
std::string FileContents
Definition: Filesystem.hpp:24
armnnUtils
Definition: CompatibleTypes.hpp:10
armnnUtils::Filesystem::ReadFileContentsIntoString
FileContents ReadFileContentsIntoString(const std::string &path)
Definition: Filesystem.cpp:102
armnnUtils::Filesystem::RemoveDirectoryAndContents
void RemoveDirectoryAndContents(const std::string &path)
Remove a directory and its contents.
Definition: Filesystem.cpp:84
armnnUtils::Filesystem::NamedTempFile
fs::path NamedTempFile(const char *fileName)
Returns a path to a file in the system temporary folder. If the file existed it will be deleted.
Definition: Filesystem.cpp:25
armnnUtils::Filesystem::CreateDirectory
std::string CreateDirectory(std::string sPath)
Returns full path to temporary folder.
Definition: Filesystem.cpp:47