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) 40