16 #include "absl/status/status.h" 19 #if !defined(__PORTABLE_PLATFORM__) 20 #if !defined(_MSC_VER) 24 #include "absl/strings/str_format.h" 25 #include "absl/time/clock.h" 27 #endif // !defined(__PORTABLE_PLATFORM__) 32 absl::string_view content) {
33 #if defined(__PORTABLE_PLATFORM__) 34 return absl::Status(absl::StatusCode::kUnimplemented,
35 "File io is not implemented for this platform.");
36 #else // defined(__PORTABLE_PLATFORM__) 38 #endif // !defined(__PORTABLE_PLATFORM__) 42 std::string* output) {
43 #if defined(__PORTABLE_PLATFORM__) 44 return absl::Status(absl::StatusCode::kUnimplemented,
45 "File io is not implemented for this platform.");
46 #else // defined(__PORTABLE_PLATFORM__) 48 #endif // !defined(__PORTABLE_PLATFORM__) 52 std::string* filename_out) {
53 #if defined(__PORTABLE_PLATFORM__) 54 LOG(
ERROR) <<
"Temporary files are not implemented for this platform.";
56 #else // defined(__PORTABLE_PLATFORM__) 58 int32_t tid = static_cast<int32_t>(pthread_self());
59 #else // defined(__linux__) 61 #endif // defined(__linux__) 62 #if !defined(_MSC_VER) 63 int32_t pid = static_cast<int32_t>(getpid());
67 int64_t now = absl::GetCurrentTimeNanos();
68 std::string filename =
69 absl::StrFormat(
"/tmp/parameters-tempfile-%x-%d-%llx", tid, pid, now);
71 #endif // !defined(__PORTABLE_PLATFORM__) 75 #if defined(__PORTABLE_PLATFORM__) 76 return absl::Status(absl::StatusCode::kUnimplemented,
77 "File io is not implemented for this platform.");
78 #else // defined(__PORTABLE_PLATFORM__) 80 #endif // !defined(__PORTABLE_PLATFORM__) absl::Status Delete(const absl::string_view &path, int flags)
bool PortableTemporaryFile(const char *directory_prefix, std::string *filename_out)
::absl::Status PortableFileGetContents(absl::string_view file_name, std::string *output)
absl::Status SetContents(const absl::string_view &filename, const absl::string_view &contents, int flags)
absl::Status GetContents(const absl::string_view &filename, std::string *output, int flags)
Collection of objects used to extend the Constraint Solver library.
::absl::Status PortableDeleteFile(absl::string_view file_name)
::absl::Status PortableFileSetContents(absl::string_view file_name, absl::string_view content)