aboutsummaryrefslogtreecommitdiff
path: root/src/base_tab/gamebase/GameBase.cpp
blob: e8f9a597e27a67525497a6e88b7efa2bdfb8a67f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "GameBase.hpp"
#include "PGNGameBase.hpp"

std::shared_ptr<GameBase> OpenDatabase(const std::string &dbpath, bool createIfNotExist){
    wxFileName file(dbpath);
    wxString ext = file.GetExt().Lower();
    if (ext == "pgn") {
        if(createIfNotExist && !file.Exists())
            PGNGameBase::CreateDatabaseFile(dbpath);
        return std::shared_ptr<GameBase>(new PGNGameBase(dbpath));
    }
    return nullptr;
}