ArmNN
 21.02
Filesystem.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "Filesystem.hpp"
7 
8 namespace armnnUtils
9 {
10 namespace Filesystem
11 {
12 
13 /**
14  * @brief Construct a temporary file name.
15  *
16  * Given a specified file name construct a path to that file in the
17  * system temporary directory. If the file already exists it is deleted. This
18  * could throw filesystem_error exceptions.
19  *
20  * @param fileName the file name required in the temporary directory.
21  * @return path consisting of system temporary directory and file name.
22  */
23 fs::path NamedTempFile(const char* fileName)
24 {
25  fs::path tmpDir = fs::temp_directory_path();
26  fs::path namedTempFile{tmpDir / fileName};
27  if (fs::exists(namedTempFile))
28  {
29  fs::remove(namedTempFile);
30  }
31  return namedTempFile;
32 }
33 
34 }
35 }
fs::path NamedTempFile(const char *fileName)
Construct a temporary file name.
Definition: Filesystem.cpp:23