Skip to content
Snippets Groups Projects
Commit 3ffb51cd authored by rswindell's avatar rswindell
Browse files

Created a new file_area.dir property that contains all the file directories the

user has access to in a single object (associative array).
parent 5390d74d
No related branches found
No related tags found
No related merge requests found
......@@ -57,6 +57,7 @@ JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_
{
char vpath[MAX_PATH+1];
JSObject* areaobj;
JSObject* alldirs;
JSObject* libobj;
JSObject* dirobj;
JSObject* lib_list;
......@@ -75,6 +76,9 @@ JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_
if(areaobj==NULL)
return(NULL);
if((alldirs=JS_NewObject(cx, NULL, NULL, areaobj))==NULL)
return(NULL);
val=INT_TO_JSVAL(cfg->min_dspace);
if(!JS_SetProperty(cx, areaobj, "min_diskspace", &val))
return(NULL);
......@@ -284,6 +288,10 @@ JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_
if(!JS_SetElement(cx, dir_list, index, &val))
return(NULL);
/* Add as property (associative array element) */
if(!JS_SetProperty(cx, alldirs, cfg->dir[d]->code, &val))
return(NULL);
#ifdef _DEBUG
js_DescribeObject(cx,dirobj,"File Transfer Directories");
#endif
......@@ -295,8 +303,13 @@ JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_
val=OBJECT_TO_JSVAL(libobj);
if(!JS_SetElement(cx, lib_list, index, &val))
return(NULL);
}
val=OBJECT_TO_JSVAL(alldirs);
if(!JS_SetProperty(cx, areaobj, "dir", &val))
return(NULL);
return(areaobj);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment