(#885) Introduce system/file module
parent
9d9a8f5891
commit
608f4b1c81
|
@ -154,6 +154,8 @@ add_executable(nothing
|
|||
src/game/level/level_editor/layer.c
|
||||
src/game/level/level_editor/label_layer.c
|
||||
src/game/level/level_editor/label_layer.h
|
||||
src/system/file.h
|
||||
src/system/file.c
|
||||
)
|
||||
target_link_libraries(nothing ${SDL2_LIBRARIES} system ebisp)
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef __linux__
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#endif // __linux__
|
||||
|
||||
#include "system/stacktrace.h"
|
||||
#include "file.h"
|
||||
|
||||
time_t last_modified(const char *filepath)
|
||||
{
|
||||
trace_assert(filepath);
|
||||
|
||||
#ifdef __linux__
|
||||
struct stat attr;
|
||||
stat(filepath, &attr);
|
||||
return attr.st_mtime;
|
||||
#endif // __linux__
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef FILE_H_
|
||||
#define FILE_H_
|
||||
|
||||
#include <time.h>
|
||||
|
||||
time_t last_modified(const char *filepath);
|
||||
|
||||
#endif // FILE_H_
|
Loading…
Reference in New Issue