blob: 5d547016be6fd5ba943a5419d569c2f5138c252c [file] [log] [blame]
Laurent Carlier749294b2020-06-01 09:03:17 +01001//
Colm Donelana98e79a2022-12-06 21:32:29 +00002// Copyright © 2020,2022 Arm Ltd and Contributors. All rights reserved.
Rob Hughesbdee4262020-01-07 17:05:24 +00003// SPDX-License-Identifier: MIT
4//
5
6#pragma once
Jim Flynn870b96c2022-03-25 21:24:56 +00007#if !defined(ARMNN_DISABLE_FILESYSTEM)
Rob Hughesbdee4262020-01-07 17:05:24 +00008
Rob Hughes35c31c02020-08-17 15:47:20 +01009#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 Flynnc9631102020-06-24 11:11:20 +010014#include <ghc/filesystem.hpp>
Colm Donelana98e79a2022-12-06 21:32:29 +000015#include <string>
16
Jim Flynnc9631102020-06-24 11:11:20 +010017namespace fs = ghc::filesystem;
18
Rob Hughesbdee4262020-01-07 17:05:24 +000019namespace armnnUtils
20{
21namespace Filesystem
22{
23
Keith Davis15f9c682022-10-14 15:50:33 +010024using FileContents = std::string;
25
Francis Murtagh532a29d2020-06-29 11:50:01 +010026/// Returns a path to a file in the system temporary folder. If the file existed it will be deleted.
27fs::path NamedTempFile(const char* fileName);
Rob Hughesbdee4262020-01-07 17:05:24 +000028
Keith Davis15f9c682022-10-14 15:50:33 +010029/// Returns full path to temporary folder
30std::string CreateDirectory(std::string sPath);
31
Colm Donelanb5ea5892023-02-10 15:19:46 +000032FileContents ReadFileContentsIntoString(const std::string& path);
33
34void RemoveDirectoryAndContents(const std::string& path);
Keith Davis15f9c682022-10-14 15:50:33 +010035
Jim Flynn870b96c2022-03-25 21:24:56 +000036} // namespace armnnUtils
37} // namespace Filesystem
38
39#endif // !defined(ARMNN_DISABLE_FILESYSTEM)