dir.h
1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* dir.h: as one might suggest here are definitions and prototypes for
* win32/dir.c
*
* Copyright (C) 2006 Georg Steffers
*
* Author: Georg Steffers [GST] <georg.steffers@aschendorff.de>
* Developer:
*
* Changes (for this file only):
* (2006-06-12) [GST] Started this changelog...well the program is
* ready since some weeks right now.
*/
#ifndef DIR_H
#define DIR_H
#include <windows.h>
#include <scot/dir_common.h>
/* abstraction for file information and an directory handle */
#define FILE_DATA struct dir_file
#define DIR_HANDLE HANDLE
/* abstraction for checking if a file is a directory */
#define IS_DIRECTORY(file_data) \
((file_data).file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
/* abstraction for getting the filename of a directory entry. */
#define DIRENT_FNAME(file_data) ((file_data).file.cFileName)
/* structure for all available information about the directory entry. */
struct dir_file
{
char path [MAX_PATH+1];
WIN32_FIND_DATA file;
};
/* the last in parameter is posix specific. It defines if stat should
* follow symlinks or not. Under Windows it is ignored. */
DIR_HANDLE get_dir_first (const char *, FILE_DATA *, int);
int get_dir_next (DIR_HANDLE, const char *, FILE_DATA *, int);
#endif /* DIR_H */