forked from noah-/d2bs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJSDirectory.h
51 lines (38 loc) · 1.16 KB
/
JSDirectory.h
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
45
46
47
48
49
50
51
#ifndef __JSDIRECTORY_H__
#define __JSDIRECTORY_H__
// TODO: Rewrite this mess of crap too
#include "js32.h"
#include <cstdlib>
#include <cstring>
CLASS_CTOR(dir);
JSAPI_FUNC(dir_getFiles);
JSAPI_FUNC(dir_getFolders);
JSAPI_FUNC(dir_create);
JSAPI_FUNC(dir_delete);
JSAPI_FUNC(my_openDir);
JSAPI_PROP(dir_getProperty);
void dir_finalize(JSFreeOp *fop, JSObject *obj);
//////////////////////////////////////////////////////////////////
// directory stuff
//////////////////////////////////////////////////////////////////
enum {DIR_NAME};
static JSPropertySpec dir_props[] = {
{"name", DIR_NAME, JSPROP_PERMANENT_VAR, JSOP_WRAPPER(dir_getProperty), JSOP_NULLWRAPPER },
{ 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER }
};
static JSFunctionSpec dir_methods[] = {
JS_FS("create", dir_create, 1, FUNCTION_FLAGS),
JS_FS("remove", dir_delete, 1, FUNCTION_FLAGS),
JS_FS("getFiles", dir_getFiles, 1, FUNCTION_FLAGS),
JS_FS("getFolders", dir_getFolders, 1, FUNCTION_FLAGS),
JS_FS_END
};
class DirData {
public:
char name[_MAX_FNAME];
DirData(char* newname)
{
strcpy_s(name, _MAX_FNAME, newname);
}
};
#endif