nsPersistentFileDescriptor targetDesc; nsInputStringStream anotherStream(target); anotherStream >> targetDesc;  nsFileSpec targetFile(targetDesc);
nsFileSpec targetFile(target);
void ReplaceScheduledFiles(void){    HREG reg;         if (REGERR_OK == NR_RegOpen("", &reg))    {        RKEY    key;	    REGENUM state;        /* replace files if any listed */        if (REGERR_OK ==  NR_RegGetKey(reg, ROOTKEY_PRIVATE, REG_REPLACE_LIST_KEY, &key))        {            char tmpfile[MAXREGNAMELEN];            char target[MAXREGNAMELEN];            state = 0;            while (REGERR_OK == NR_RegEnumEntries(reg, key, &state, tmpfile, sizeof(tmpfile), NULL ))            {                                nsPersistentFileDescriptor doomedDesc;                nsInputStringStream tempStream(tmpfile);                tempStream >> doomedDesc;                                nsFileSpec replaceFile(doomedDesc);                if (! replaceFile.Exists() )                {                    NR_RegDeleteEntry( reg, key, tmpfile );                }                else if ( REGERR_OK != NR_RegGetEntryString( reg, key, tmpfile, target, sizeof(target) ) )                {                    /* can't read target filename, corruption? */                    NR_RegDeleteEntry( reg, key, tmpfile );                }                else                 {                    nsPersistentFileDescriptor targetDesc;                    nsInputStringStream anotherStream(target);                    anotherStream >> targetDesc;                                        nsFileSpec targetFile(targetDesc);                                    targetFile.Delete(PR_FALSE);                                    if (!targetFile.Exists())                    {                        nsFileSpec parentofTarget;                        targetFile.GetParent(parentofTarget);                                                                                       nsresult result = replaceFile.Move(parentofTarget);                        if ( NS_SUCCEEDED(result) )                        {                            char* leafName = targetFile.GetLeafName();                            replaceFile.Rename(leafName);                            nsCRT::free(leafName);                                                        NR_RegDeleteEntry( reg, key, tmpfile );                        }                    }                }            }            /* delete list node if empty */            if (REGERR_NOMORE == NR_RegEnumEntries(reg, key, &state, tmpfile, sizeof(tmpfile), NULL ))             {                NR_RegDeleteKey(reg, ROOTKEY_PRIVATE, REG_REPLACE_LIST_KEY);            }        }                NR_RegClose(reg);    }}