X-Git-Url: http://winboard.nl/cgi-bin?p=polyglot.git;a=blobdiff_plain;f=util.c;h=a5af1173347ebdb6e4876aa73308250057b7e010;hp=3016e23d9add324b2e91229601db9af35785210f;hb=cd81270f2b1723e0798f4d6dcaee134f0b4aca7f;hpb=ac968003c13bde5c86ffa19f8819e436b5bc03e6 diff --git a/util.c b/util.c index 3016e23..a5af117 100644 --- a/util.c +++ b/util.c @@ -25,6 +25,10 @@ #include "main.h" #include "util.h" +// macros + +#define StringSize 4096 + // variables static bool Error; @@ -235,6 +239,32 @@ bool my_file_read_line(FILE * file, char string[], int size) { return TRUE; } +// my_file_join() + +void my_path_join(char *join_path, const char *path, const char *file){ + char separator; +#ifdef _WIN32 + separator='\\'; +#else + separator='/'; +#endif + snprintf(join_path,StringSize,"%s%c%s",path,separator,file); + join_path[StringSize-1]='\0'; +} + +// my_mkdir() + +int my_mkdir(const char *path){ + int ret; +#ifdef _WIN32 + ret=_mkdir(path); +#else + ret=mkdir(path,S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); +#endif + return ret; +} + + // my_string_empty() bool my_string_empty(const char string[]) {