blob: 51f080ecc6d643ce1b3a1af240e62bdd48585733 [file] [log] [blame]
#include "fileutil.h"
#include <errno.h>
#include <limits.h>
#include <sys/stat.h>
#include <unistd.h>
#include "log.h"
bool Exists(StringPiece filename) {
CHECK(filename.size() < PATH_MAX);
char buf[PATH_MAX+1];
memcpy(buf, filename.data(), filename.size());
buf[filename.size()] = 0;
struct stat st;
if (stat(buf, &st) < 0) {
return false;
}
return true;
}