Welcome to mirror list, hosted at ThFree Co, Russian Federation.

file.c « base « src - github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5156a4fe89415a455a5822da805435ebd282ce38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
 * \file   file.c
 * \brief  File handling.
 * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
 */

#include <assert.h>
#include <sys/stat.h>
#include "premake.h"
#include "base.h"


/**
 * Determine if a particular file exists on the filesystem.
 * \returns True if the file exists.
 */
int file_exists(const char* path)
{
	struct stat buf;

	assert(path);

	if (stat(path, &buf) == 0)
	{
		return ((buf.st_mode & S_IFDIR) == 0);
	}
	else
	{
		return 0;
	}
}