18#include "absl/status/status.h"
21#if !defined(__PORTABLE_PLATFORM__)
26#include "absl/strings/str_format.h"
27#include "absl/time/clock.h"
36 absl::string_view content) {
37#if defined(__PORTABLE_PLATFORM__)
38 return absl::Status(absl::StatusCode::kUnimplemented,
39 "File io is not implemented for this platform.");
46 std::string* output) {
47#if defined(__PORTABLE_PLATFORM__)
48 return absl::Status(absl::StatusCode::kUnimplemented,
49 "File io is not implemented for this platform.");
56 std::string* filename_out) {
57#if defined(__PORTABLE_PLATFORM__)
58 LOG(ERROR) <<
"Temporary files are not implemented for this platform.";
62 int32_t tid =
static_cast<int32_t
>(pthread_self());
67 int32_t pid =
static_cast<int32_t
>(getpid());
71 int64_t now = absl::GetCurrentTimeNanos();
72 std::string filename =
73 absl::StrFormat(
"/tmp/parameters-tempfile-%x-%d-%llx", tid, pid, now);
79#if defined(__PORTABLE_PLATFORM__)
80 return absl::Status(absl::StatusCode::kUnimplemented,
81 "File io is not implemented for this platform.");
absl::StatusOr< std::string > GetContents(absl::string_view path, Options options)
absl::Status SetContents(absl::string_view filename, absl::string_view contents, Options options)
absl::Status Delete(absl::string_view path, Options options)
In SWIG mode, we don't want anything besides these top-level includes.
bool PortableTemporaryFile(const char *directory_prefix, std::string *filename_out)
Returns true if successful. Outputs temp file to filename.
::absl::Status PortableDeleteFile(absl::string_view file_name)
::absl::Status PortableFileGetContents(absl::string_view file_name, std::string *output)
::absl::Status PortableFileSetContents(absl::string_view file_name, absl::string_view content)