5 #if !defined(ARMNN_DISABLE_FILESYSTEM)
27 fs::path tmpDir = fs::temp_directory_path();
28 fs::path namedTempFile{tmpDir / fileName};
29 if (fs::exists(namedTempFile))
31 fs::remove(namedTempFile);
50 fs::path tmpDir = fs::temp_directory_path();
51 std::string full_path = tmpDir.generic_string() + path;
52 if (fs::exists(full_path))
57 fs::remove_all(full_path);
59 catch (
const std::system_error& e)
61 std::string
error =
"Directory exists and cannot be removed. Reason: ";
62 error.append(e.what());
67 result = _mkdir(full_path.c_str());
68 armnn::ConditionalThrow<armnn::RuntimeException>((result == 0),
"Was unable to create temporary directory");
72 if(!fs::create_directory(full_path))
77 catch (
const std::system_error& e)
79 std::string
error =
"Unable to create directory. Reason: ";
80 error.append(e.what());
85 return full_path +
"/";
89 if (!fs::exists(path))
93 std::ifstream input_file(path);
94 armnn::ConditionalThrow<armnn::RuntimeException>((input_file.is_open()),
"Could not read file contents");
95 return FileContents((std::istreambuf_iterator<char>(input_file)), std::istreambuf_iterator<char>());
101 #endif // !defined(ARMNN_DISABLE_FILESYSTEM)