[Add] Implemented some cross platform solutions.
This commit is contained in:
parent
35b4339abd
commit
9b67305893
11
src/lfile.c
11
src/lfile.c
@ -6,6 +6,7 @@
|
|||||||
* @todo Add support for windows and mac OS.
|
* @todo Add support for windows and mac OS.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
@ -14,7 +15,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -37,7 +37,14 @@ char* lfile_basePath(void) {
|
|||||||
home = getenv("HOME");
|
home = getenv("HOME");
|
||||||
snprintf(lephisto_base, PATH_MAX, "%s/.lephisto/", home);
|
snprintf(lephisto_base, PATH_MAX, "%s/.lephisto/", home);
|
||||||
#else
|
#else
|
||||||
#error "Needs implentation."
|
FILE* f;
|
||||||
|
|
||||||
|
/* Try to open the file, C89 compliant, but not as precise as stat. */
|
||||||
|
f = fopen(file, 'r');
|
||||||
|
if(f != NULL) {
|
||||||
|
fclose(f);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user