1 // Copyright (C) 2010-2016 Joel Rosdahl
3 // This program is free software; you can redistribute it and/or modify it
4 // under the terms of the GNU General Public License as published by the Free
5 // Software Foundation; either version 3 of the License, or (at your option)
8 // This program is distributed in the hope that it will be useful, but WITHOUT
9 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 // You should have received a copy of the GNU General Public License along with
14 // this program; if not, write to the Free Software Foundation, Inc., 51
15 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 #include "../system.h"
21 # define lstat(a, b) stat(a, b)
25 path_exists(const char *path)
28 return lstat(path, &st) == 0;
32 create_file(const char *path, const char *content)
34 FILE *f = fopen(path, "w");
35 if (!f || fputs(content, f) < 0) {
36 fprintf(stderr, "create_file: %s: %s\n", path, strerror(errno));