aboutsummaryrefslogtreecommitdiff
path: root/src/base_tab/gamebase/GameBase.cpp
blob: 4c7c1a36b48b1849ef7f762c5271a377cc15135d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#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();
    bool create=createIfNotExist && !file.Exists();
    if (ext == "pgn") {
        if(create)
            PGNGameBase::CreateDatabaseFile(dbpath);
        return std::shared_ptr<GameBase>(new PGNGameBase(dbpath));
    }
    return nullptr;
}