dir.h 1.29 KB
/*
 * 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 */