|
|
|
@ -1137,6 +1137,7 @@ get_conf_bool_cb(JSContextRef context,
|
|
|
|
|
return JSValueMakeBoolean(context, value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static JSValueRef |
|
|
|
|
get_dirlist_cb(JSContextRef context, |
|
|
|
|
JSObjectRef function, |
|
|
|
@ -1144,6 +1145,7 @@ get_dirlist_cb(JSContextRef context,
|
|
|
|
|
size_t argumentCount, |
|
|
|
|
const JSValueRef arguments[], |
|
|
|
|
JSValueRef *exception) { |
|
|
|
|
|
|
|
|
|
JSObjectRef array; |
|
|
|
|
guint n_entries = 0; |
|
|
|
|
JSValueRef *args = NULL; |
|
|
|
@ -1157,6 +1159,7 @@ get_dirlist_cb(JSContextRef context,
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
path = arg_to_string(context, arguments[0], exception); |
|
|
|
|
|
|
|
|
|
if (!path) { |
|
|
|
|
return JSValueMakeNull(context); |
|
|
|
|
} |
|
|
|
@ -1170,9 +1173,8 @@ get_dirlist_cb(JSContextRef context,
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Create the lis of the directory entries |
|
|
|
|
* Create the list of the directory entries |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
while ( ( dirent = g_dir_read_name(dir) ) != NULL) { |
|
|
|
|
n_entries++; |
|
|
|
|
args = g_realloc( args, sizeof(JSValueRef) * ( n_entries + 1 ) ); |
|
|
|
@ -1184,7 +1186,9 @@ get_dirlist_cb(JSContextRef context,
|
|
|
|
|
g_dir_close(dir); |
|
|
|
|
|
|
|
|
|
array = JSObjectMakeArray(context, n_entries, args, exception); |
|
|
|
|
|
|
|
|
|
g_free(args); |
|
|
|
|
|
|
|
|
|
if (array == NULL) { |
|
|
|
|
return JSValueMakeNull(context); |
|
|
|
|
} else { |
|
|
|
|