mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Allow "project.json5" to be used.
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#define MAX_ARRAY_SIZE INT64_MAX
|
||||
#define MAX_SOURCE_LOCATION_LEN 255
|
||||
#define PROJECT_JSON "project.json"
|
||||
#define PROJECT_JSON5 "project.json5"
|
||||
|
||||
#if defined( _WIN32 ) || defined( __WIN32__ ) || defined( _WIN64 )
|
||||
#define PLATFORM_WINDOWS 1
|
||||
|
||||
@@ -421,12 +421,13 @@ void file_find_top_dir()
|
||||
while (1)
|
||||
{
|
||||
struct stat info;
|
||||
int err = stat(PROJECT_JSON, &info);
|
||||
const char *filename = file_exists(PROJECT_JSON5) ? PROJECT_JSON5 : PROJECT_JSON;
|
||||
int err = stat(filename, &info);
|
||||
|
||||
// Error and the it's not a "missing file"?
|
||||
if (err && errno != ENOENT)
|
||||
{
|
||||
error_exit("Can't open %s: %s.", PROJECT_JSON, strerror(errno));
|
||||
error_exit("Can't open %s: %s.", filename, strerror(errno));
|
||||
}
|
||||
|
||||
// Everything worked and it's a regular file? We're done!
|
||||
|
||||
Reference in New Issue
Block a user