/**
Construct a descriptor containing the composite file name from the DLL to load

@param aSwp The swp to create the file name for
@param aLibraryFilename reference to object in which file name is returned
@leave KErrNotFound If the swp is not registered
*/
void CSsmSwpPolicyResolver::GetFileNameForSwpL(const TSsmSwp& aSwp, TDes& aLibraryFilename) const
	{
	aLibraryFilename.Zero();
	aLibraryFilename.Append(KRomDriveLetter);
	aLibraryFilename.Append(iSwpPolicyMap->FilenameL(aSwp.Key()));
	const TInt postfixLength = KDllFilenamePostfix().Length();
	if(KDllFilenamePostfix().CompareF(aLibraryFilename.Right(postfixLength)))
		{
		aLibraryFilename.Append(KDllFilenamePostfix);
		}
	}
/**
Resolves directionality of the given source text.
Place-holder strings are removed so that they don't affect the result.
*/
TBidiText::TDirectionality CResourceLoader::ResolveDirectionality(TDes& aText, TBool* aFound)
    {
    TInt i = 0;

    // Remove place-holders from string so they don't affect directionality
    // length parameters e.g. "[29]" do not contain strongly directional
    // characters so can ignore them.
    while (i < aText.Length())
        {
        TPtrC remainder = aText.Right(aText.Length() - i);
        TInt nextKey = remainder.Locate(KKeyPrefix);
        i += nextKey;

        if (nextKey != KErrNotFound && i < aText.Length() - 1)
            {
            TInt lastCharInKey = i + 1;

            // skip possible key index
            TText t = aText[lastCharInKey];
            if (t >= '0' && t <= '9')
                {
                lastCharInKey++;

                if (lastCharInKey < aText.Length())
                    {
                    t = aText[lastCharInKey];
                    if (t >= '0' && t <= '9')
                        {
                        lastCharInKey++;
                        }
                    }
                }

            // lastCharInKey is now the index of 'N' or 'U' in the key

            if (lastCharInKey < aText.Length())
                {
                TText t = aText[lastCharInKey];
                if (t == 'U' || t == 'N')
                    {
                    // found key, delete it and continue loop to
                    // search for the next key
                    aText.Delete(i, lastCharInKey - i + 1);
                    }
                // This was not a proper key - check the remaining string
                else
                    {
                    i = lastCharInKey + 1;
                    }
                }
            // end of string encountered - stop
            else
                {
                break;
                }
            }
        // no key found - stop
        else
            {
            break;
            }
        }

    return TBidiText::TextDirectionality(aText, aFound);
    }