Commit 6f8ea87b authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Add "name" property, matching Deuce's jsdoor fork

Convenient way to get the path/name of the archive file as it was passed to the constructor.
parent f008b49a
Pipeline #2733 passed with stage
in 9 minutes and 32 seconds
......@@ -196,6 +196,19 @@ js_archive_type(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
return JS_TRUE;
static JSBool
js_archive_name(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
const char* filename;
if((filename = js_GetClassPrivate(cx, obj, &js_archive_class)) == NULL)
return JS_FALSE;
JSString* js_str = JS_NewStringCopyZ(cx, filename);
*vp = STRING_TO_JSVAL(js_str);
return JS_TRUE;
// TODO: consider making 'path' and 'case-sensitive' arguments to wildmatch() configurable via method arguments
static JSBool
js_list(JSContext *cx, uintN argc, jsval *arglist)
......@@ -582,6 +595,7 @@ static jsSyncMethodSpec js_archive_functions[] = {
static char* archive_prop_desc[] = {
"format/compression type of archive file - <small>READ ONLY</small>"
,"filename specified in constructor - <small>READ ONLY</small>"
......@@ -612,6 +626,10 @@ js_archive_constructor(JSContext *cx, uintN argc, jsval *arglist)
JS_ReportError(cx, "JS_DefineProperty failed");
return JS_FALSE;
if(!JS_DefineProperty(cx, obj, "name", JSVAL_VOID, js_archive_name, NULL, JSPROP_ENUMERATE|JSPROP_READONLY)) {
JS_ReportError(cx, "JS_DefineProperty failed");
return JS_FALSE;
js_DescribeSyncObject(cx,obj,"Class used for creating, reading, or extracting archive files on the local file system<br>"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment