mirror of
https://github.com/retro100/dosbox-wii.git
synced 2024-11-05 01:45:11 +01:00
Remove dirent.h and dirent.c which doesn't exist at original r3783. Move globals.cpp to wii subfolder.
This commit is contained in:
parent
05391254ee
commit
03ba330e85
@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Implementation of the standard functions in direct.h
|
||||
*
|
||||
* opendir(), readdir(), closedir() and rewinddir().
|
||||
*
|
||||
* 06/17/2000 by Mike Haaland <mhaaland@hypertech.com>
|
||||
*/
|
||||
|
||||
#include "dirent.h"
|
||||
#include "io.h"
|
||||
|
||||
#define safe_strncpy_dirent(a,b,n) do { strncpy((a),(b),(n)-1); (a)[(n)-1] = 0; } while (0)
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
/** open the current directory and return a structure
|
||||
* to be used in subsequent readdir() and closedir()
|
||||
* calls.
|
||||
*
|
||||
* returns NULL if one error.
|
||||
*/
|
||||
DIR * opendir(const char *dirname) {
|
||||
|
||||
static DIR dir;
|
||||
size_t len;
|
||||
|
||||
/* Stash the directory name */
|
||||
safe_strncpy_dirent(dir.pathName,dirname,260);
|
||||
|
||||
len = strlen(dirname);
|
||||
if ((len>0) && (dirname[len-1]=='\\')) strcat(dir.pathName,"*.*");
|
||||
else strcat(dir.pathName,"\\*.*");
|
||||
|
||||
/* set the handle to invalid and set the firstTime flag */
|
||||
dir.handle = INVALID_HANDLE_VALUE;
|
||||
dir.firstTime = TRUE;
|
||||
|
||||
/* Change the current directory to the one requested */
|
||||
return (access(dirname,0) ? NULL : &dir);
|
||||
}
|
||||
|
||||
/** Close the current directory - return 0 if success */
|
||||
int closedir(DIR *dirp) {
|
||||
/* reset ourselves to the first file in the directory
|
||||
*
|
||||
* We just close the current handle and reset for the
|
||||
* next readdir call
|
||||
*/
|
||||
int result = 1;
|
||||
|
||||
if (dirp->handle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
result = FindClose(dirp->handle);
|
||||
dirp->handle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
return (result == 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
/** get the next entry in the directory */
|
||||
struct dirent * readdir(DIR *dirp) {
|
||||
static struct dirent d;
|
||||
|
||||
if (TRUE == dirp->firstTime)
|
||||
{
|
||||
/** Get the first entry in the directory */
|
||||
dirp->handle = FindFirstFile(dirp->pathName, &dirp->findFileData);
|
||||
dirp->firstTime = FALSE;
|
||||
if (INVALID_HANDLE_VALUE == dirp->handle)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int result = FindNextFile(dirp->handle, &dirp->findFileData);
|
||||
if (0 == result )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
/* we have a valid FIND_FILE_DATA, copy the filename */
|
||||
memset(&d,'\0', sizeof(struct dirent));
|
||||
|
||||
safe_strncpy_dirent(d.d_name,dirp->findFileData.cFileName,260);
|
||||
d.d_namlen = (char)strlen(d.d_name);
|
||||
|
||||
return &d;
|
||||
}
|
||||
|
||||
/** reopen the current directory */
|
||||
void rewinddir(DIR *dirp) {
|
||||
closedir(dirp);
|
||||
dirp->firstTime = TRUE;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,58 +0,0 @@
|
||||
|
||||
|
||||
/*
|
||||
* Defines and structures used to implement the
|
||||
* functionality standard in direct.h for:
|
||||
*
|
||||
* opendir(), readdir(), closedir() and rewinddir().
|
||||
*
|
||||
* 06/17/2000 by Mike Haaland <mhaaland@hypertech.com>
|
||||
*/
|
||||
#ifndef _DIRENT_H_
|
||||
#define _DIRENT_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <direct.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
/* Convienience macros used with stat structures */
|
||||
#define S_ISDIR(x) (x & _S_IFDIR)
|
||||
#define S_ISREG(x) (x & _S_IFREG)
|
||||
#endif
|
||||
|
||||
|
||||
/* Structure to keep track of the current directory status */
|
||||
typedef struct my_dir {
|
||||
HANDLE handle;
|
||||
WIN32_FIND_DATA findFileData;
|
||||
BOOLEAN firstTime;
|
||||
char pathName[MAX_PATH];
|
||||
} DIR;
|
||||
|
||||
/* Standard directory name entry returned by readdir() */
|
||||
struct dirent {
|
||||
char d_namlen;
|
||||
char d_name[MAX_PATH];
|
||||
};
|
||||
|
||||
/* function prototypes */
|
||||
int closedir(DIR *dirp);
|
||||
DIR * opendir(const char *dirname);
|
||||
struct dirent * readdir(DIR *dirp);
|
||||
void rewinddir(DIR *dirp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user