Skip to content
Snippets Groups Projects
Commit e8567ab4 authored by deuce's avatar deuce
Browse files

Add fullpath() function.

parent aa20f221
No related branches found
No related tags found
No related merge requests found
......@@ -2327,6 +2327,29 @@ js_backslash(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
return(JS_TRUE);
}
static JSBool
js_fullpath(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
char path[MAX_PATH+1];
char* str;
JSString* js_str;
if(JSVAL_IS_VOID(argv[0]))
return(JS_TRUE);
if((str=js_ValueToStringBytes(cx, argv[0], NULL))==NULL)
return(JS_FALSE);
SAFECOPY(path,str);
_fullpath(path, str, sizeof(path));
if((js_str = JS_NewStringCopyZ(cx, path))==NULL)
return(JS_FALSE);
*rval = STRING_TO_JSVAL(js_str);
return(JS_TRUE);
}
static JSBool
js_getfname(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
......@@ -3206,6 +3229,10 @@ static jsSyncMethodSpec js_global_functions[] = {
"(i.e. \"slash\" or \"backslash\")")
,312
},
{"fullpath", js_fullpath, 1, JSTYPE_STRING, JSDOCSTR("path")
,JSDOCSTR("Creates an absolute or full path name for the specified relative path name.")
,315
},
{"file_getname", js_getfname, 1, JSTYPE_STRING, JSDOCSTR("path/filename")
,JSDOCSTR("returns filename portion of passed path string")
,311
......
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