aliasLeaf.Append(NS_LITERAL_STRING(" alias"));
aliasLeaf.AppendLiteral(" alias");
InstallFileOpFileMacAlias(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval){  nsInstall        *nativeThis = (nsInstall *)JS_GetPrivate(cx, obj);  PRInt32          nativeRet;  nsAutoString     sourceLeaf, aliasLeaf;  JSObject         *jsoSourceFolder, *jsoAliasFolder;  nsInstallFolder  *nsifSourceFolder, *nsifAliasFolder;  nsresult         rv1 = NS_OK, rv2 = NS_OK;    *rval = JSVAL_NULL;  // If there's no private data, this must be the prototype, so ignore  if(nsnull == nativeThis)  {    return JS_TRUE;  }  if(argc >= 3)  {    // public int FileMacAlias( InstallFolder aSourceFolder,    //                          String        aSourceName,    //                          InstallFolder aAliasFolder );    // where    //      aSourceFolder -- the folder of the installed file from Get*Folder() APIs    //      aSourceName   -- the installed file's name    //      aAliasFolder  -- the folder of the new alias from Get*Folder() APIs    //    // NOTE:     //      The destination alias name is aSourceName + " alias" (Mac-like behavior).     //          //      returns SUCCESS for successful scheduling of operation    //              UNEXPECTED_ERROR for failure        if (argv[0] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[0]) ||  // InstallFolder aSourceFolder        argv[2] == JSVAL_NULL || !JSVAL_IS_OBJECT(argv[2]))    // InstallFolder aAliasFolder    {        *rval = INT_TO_JSVAL(nsInstall::INVALID_ARGUMENTS);        return JS_TRUE;    }    jsoSourceFolder = JSVAL_TO_OBJECT(argv[0]);    jsoAliasFolder  = JSVAL_TO_OBJECT(argv[2]);    if ((!JS_InstanceOf(cx, jsoSourceFolder, &FileSpecObjectClass, nsnull)) ||        (!JS_InstanceOf(cx, jsoAliasFolder,  &FileSpecObjectClass, nsnull)))    {        *rval = INT_TO_JSVAL(nsInstall::INVALID_ARGUMENTS);        return JS_TRUE;    }    nsifSourceFolder = (nsInstallFolder *) JS_GetPrivate(cx, jsoSourceFolder);    nsifAliasFolder  = (nsInstallFolder *) JS_GetPrivate(cx, jsoAliasFolder);    if (!nsifSourceFolder || !nsifAliasFolder)    {        *rval = INT_TO_JSVAL(nsInstall::INVALID_ARGUMENTS);        return JS_TRUE;    }    // make copies of the InstallFolders leaving originals uncontaminated    nsCOMPtr<nsIFile> iFileSourceOrig = nsifSourceFolder->GetFileSpec();     nsCOMPtr<nsIFile> iFileAliasOrig  = nsifAliasFolder->GetFileSpec();    nsCOMPtr<nsIFile> iFileSource;    nsCOMPtr<nsIFile> iFileAlias;    rv1 = iFileSourceOrig->Clone(getter_AddRefs(iFileSource));    rv2 = iFileAliasOrig->Clone(getter_AddRefs(iFileAlias));    if (NS_FAILED(rv1) || NS_FAILED(rv2))    {        *rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);        return JS_TRUE;    }        ConvertJSValToStr(sourceLeaf, cx, argv[1]);    rv1 = iFileSource->Append(sourceLeaf);            // public int FileMacAlias( InstallFolder aSourceFolder,    //                          String        aSourceFileName,    //                          InstallFolder aAliasFolder,    //                          String        aAliasName );    // where    //      aSourceFolder -- the folder of the installed file from Get*Folder() APIs    //      aSourceName   -- the installed file's name    //      aAliasFolder  -- the folder of the new alias from Get*Folder() APIs    //      aAliasName    -- the actual name of the new alias    //          //      returns SUCCESS for successful scheduling of operation    //              UNEXPECTED_ERROR for failure        if (argc >= 4)     {        ConvertJSValToStr(aliasLeaf, cx, argv[3]);    }    else    {    	aliasLeaf = sourceLeaf;        aliasLeaf.Append(NS_LITERAL_STRING(" alias"));   // XXX use GetResourcedString(id)    }        rv2 = iFileAlias->Append(aliasLeaf);	if (NS_FAILED(rv1) || NS_FAILED(rv2))	{		*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);		return JS_TRUE;	}    if(NS_OK != nativeThis->FileOpFileMacAlias(iFileSource, iFileAlias, &nativeRet))    {        *rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);        return JS_TRUE;    }    *rval = INT_TO_JSVAL(nativeRet);  }  else  {    JS_ReportError(cx, "Function FileMacAlias requires 3 or 4 parameters");    return JS_TRUE;  }  return JS_TRUE;}