From 582e01c06f9ecee25a31c34562926b41dc2856eb Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 9 Feb 2005 09:50:29 +0000 Subject: * Automatically upgrade <= 0.7 Nix stores to the new schema (so that existing user environments continue to work). * `nix-store --verify': detect incomplete closures. --- src/libutil/util.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/libutil/util.cc') diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 2fb3e9ee6853..27df7a1aaa52 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -185,6 +185,15 @@ string readFile(const Path & path) } +void writeFile(const Path & path, const string & s) +{ + AutoCloseFD fd = open(path.c_str(), O_WRONLY | O_TRUNC | O_CREAT, 0666); + if (fd == -1) + throw SysError(format("opening file `%1%'") % path); + writeFull(fd, (unsigned char *) s.c_str(), s.size()); +} + + static void _deletePath(const Path & path) { checkInterrupt(); -- cgit 1.4.1