Example #1
0
///////////////////////////////////////////////////////////////////////////////
// Returns true if it successfully opens a document with the specified path.
// 
bool DocumentManager::OpenDocument( const DocumentPtr& document, tstring& error )
{
    if ( !document->GetPath().empty() )
    {
        if ( FindDocument( document->GetPath() ) )
        {
            error = TXT( "The specified file (" ) + document->GetPath().Filename() + TXT( ") is already open." );
            return false;
        }

        if ( !document->IsUpToDate() )
        {
            error = TXT( "The version of '" ) + document->GetPath().Filename() + TXT( "' on your computer is out of date.  You will not be able to check it out." );
            return false;
        }
    }

    AddDocument( document );
    return true;
}