mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-03-22 02:31:28 +00:00
Less duplication
This commit is contained in:
parent
c7e3e3e306
commit
3b630ec5dc
1 changed files with 24 additions and 40 deletions
64
fs.c
64
fs.c
|
@ -300,50 +300,34 @@ int fs_file_getline(char **lineptr, size_t *n, FILE *stream) {
|
|||
*/
|
||||
# undef S_ISDIR
|
||||
# define S_ISDIR(X) ((X)&_S_IFDIR)
|
||||
#elif !defined(__MINGW32__)
|
||||
#include <sys/stat.h> /* mkdir */
|
||||
#include <unistd.h> /* chdir */
|
||||
|
||||
int fs_dir_make(const char *path) {
|
||||
return mkdir(path, 0700);
|
||||
}
|
||||
|
||||
DIR *fs_dir_open(const char *name) {
|
||||
return opendir(name);
|
||||
}
|
||||
|
||||
int fs_dir_close(DIR *dir) {
|
||||
return closedir(dir);
|
||||
}
|
||||
|
||||
struct dirent *fs_dir_read(DIR *dir) {
|
||||
return readdir(dir);
|
||||
}
|
||||
|
||||
int fs_dir_change(const char *path) {
|
||||
return chdir(path);
|
||||
}
|
||||
#else
|
||||
int fs_dir_make(const char *path) {
|
||||
return mkdir(path);
|
||||
}
|
||||
# if !defined(__MINGW32__)
|
||||
# include <sys/stat.h> /* mkdir */
|
||||
# include <unistd.h> /* chdir */
|
||||
|
||||
DIR *fs_dir_open(const char *name) {
|
||||
return opendir(name);
|
||||
}
|
||||
int fs_dir_make(const char *path) {
|
||||
return mkdir(path, 0700);
|
||||
}
|
||||
# else
|
||||
int fs_dir_make(const char *path) {
|
||||
return mkdir(path);
|
||||
}
|
||||
# endif /*! !defined(__MINGW32__) */
|
||||
|
||||
int fs_dir_close(DIR *dir) {
|
||||
return closedir(dir);
|
||||
}
|
||||
DIR *fs_dir_open(const char *name) {
|
||||
return opendir(name);
|
||||
}
|
||||
|
||||
struct dirent *fs_dir_read(DIR *dir) {
|
||||
return readdir(dir);
|
||||
}
|
||||
|
||||
int fs_dir_change(const char *path) {
|
||||
return chdir(path);
|
||||
}
|
||||
#endif
|
||||
int fs_dir_close(DIR *dir) {
|
||||
return closedir(dir);
|
||||
}
|
||||
|
||||
struct dirent *fs_dir_read(DIR *dir) {
|
||||
return readdir(dir);
|
||||
}
|
||||
|
||||
int fs_dir_change(const char *path) {
|
||||
return chdir(path);
|
||||
}
|
||||
|
||||
#endif /*! defined(_WIN32) && !defined(__MINGW32__) */
|
||||
|
|
Loading…
Reference in a new issue