//----------------------------------------------------------------------------------------
// MakeFullAdFilePath
//----------------------------------------------------------------------------------------
PMString
ZMAdFileFacade::MakeFullAdFilePath(
	const IZMAdInfo *					inAdInfo) const
{
	LogFunctionEnterExit;
	PMString toReturn;
	do
	{
		if( !inAdInfo )
			break;

		const PMString & adUrl = inAdInfo->GetUrl();
		toReturn = adUrl;

		if( adUrl.CharCount() == 0 )
			break;

		const PMString toFind( "%path%" );

		CharCounter foundIndex = adUrl.IndexOfString( toFind );

		if( foundIndex == -1 )
			break;

		InterfacePtr<const IWorkspace> iWorkspace(gSession->QueryWorkspace());
		InterfacePtr<const IZMPrefs> workspacePrefs( iWorkspace, UseDefaultIID() );
		ASSERT( workspacePrefs );

		const PMString & repositoryLocation = workspacePrefs->GetRepositoryPath();
		if( repositoryLocation.CharCount() == 0 )
			return kNullString;

		toReturn.Remove( foundIndex, toFind.CharCount() );
		if( foundIndex > 0 )
		{
			toReturn.Remove( 0, foundIndex );
			foundIndex = 0;
		}

		toReturn.Insert( repositoryLocation, foundIndex );

#ifdef MACINTOSH
		toReturn = Utils<IZMFileUtils>()->ReplaceSlashWithColon( toReturn );
		//const PMString volumeStr(":Volumes:");
		//toReturn.Insert(volumeStr, 0 );

		//toReturn = Utils<IZMFileUtils>()->MacPosixToUnixPath(toReturn);
#endif

	}while(false);

	IZPLog_Str( thisFileLA, enLT_DebugInfo, "Ad url for dnd = %s", toReturn.GrabCString() );

	return toReturn;
}