Laurent Carlier | 749294b | 2020-06-01 09:03:17 +0100 | [diff] [blame] | 1 | // |
Jim Flynn | 6da6a45 | 2020-07-14 14:26:27 +0100 | [diff] [blame] | 2 | // Copyright © 2020 Arm Ltd and Contributors. All rights reserved. |
Rob Hughes | bdee426 | 2020-01-07 17:05:24 +0000 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
Jim Flynn | 870b96c | 2022-03-25 21:24:56 +0000 | [diff] [blame] | 7 | #if !defined(ARMNN_DISABLE_FILESYSTEM) |
Rob Hughes | bdee426 | 2020-01-07 17:05:24 +0000 | [diff] [blame] | 8 | |
Rob Hughes | 35c31c0 | 2020-08-17 15:47:20 +0100 | [diff] [blame] | 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 |
Jim Flynn | c963110 | 2020-06-24 11:11:20 +0100 | [diff] [blame] | 14 | #include <ghc/filesystem.hpp> |
| 15 | namespace fs = ghc::filesystem; |
| 16 | |
Rob Hughes | bdee426 | 2020-01-07 17:05:24 +0000 | [diff] [blame] | 17 | namespace armnnUtils |
| 18 | { |
| 19 | namespace Filesystem |
| 20 | { |
| 21 | |
Keith Davis | 15f9c68 | 2022-10-14 15:50:33 +0100 | [diff] [blame] | 22 | using FileContents = std::string; |
| 23 | |
Francis Murtagh | 532a29d | 2020-06-29 11:50:01 +0100 | [diff] [blame] | 24 | /// Returns a path to a file in the system temporary folder. If the file existed it will be deleted. |
| 25 | fs::path NamedTempFile(const char* fileName); |
Rob Hughes | bdee426 | 2020-01-07 17:05:24 +0000 | [diff] [blame] | 26 | |
Keith Davis | 15f9c68 | 2022-10-14 15:50:33 +0100 | [diff] [blame] | 27 | /// Returns full path to temporary folder |
| 28 | std::string CreateDirectory(std::string sPath); |
| 29 | |
| 30 | FileContents ReadFileContentsIntoString(const std::string path); |
| 31 | |
Jim Flynn | 870b96c | 2022-03-25 21:24:56 +0000 | [diff] [blame] | 32 | } // namespace armnnUtils |
| 33 | } // namespace Filesystem |
| 34 | |
| 35 | #endif // !defined(ARMNN_DISABLE_FILESYSTEM) |