Beispiel #1
0
//
// load all .sdl files in sdl directory, and create descriptors for each.
// return false on error
//
bool plSDLParser::IReadDescriptors() const
{
    plFileName sdlDir = plSDLMgr::GetInstance()->GetSDLDir();
    DebugMsg("SDL: Reading latest descriptors from directory {}", sdlDir);

    // Get the names of all the sdl files
    std::vector<plFileName> files = plStreamSource::GetInstance()->GetListOfNames(sdlDir, "sdl");

    bool ret=true;
    int cnt=0;
    for (int i = 0; i < files.size(); i++)
    {
        if (!ILoadSDLFile(files[i]))
        {
            plNetApp* netApp = plSDLMgr::GetInstance()->GetNetApp();
            if (netApp)
                netApp->ErrorMsg("Error loading SDL file {}", files[i]);
            else
                hsStatusMessageF("Error loading SDL file %s", files[i].AsString().c_str());
            ret=false;
        }
        else
            cnt++;
    }
    DebugMsg("Done reading SDL files"); 

    if (!cnt)
        ret=false;

    return ret;
}
//
// load all .sdl files in sdl directory, and create descriptors for each.
// return false on error
//
bool plSDLParser::IReadDescriptors() const
{
    std::string sdlDir = plSDLMgr::GetInstance()->GetSDLDir();
    DebugMsg("SDL: Reading latest descriptors from directory %s", sdlDir.c_str());

    wchar_t* temp = hsStringToWString(sdlDir.c_str());
    std::wstring wSDLDir = temp;
    delete [] temp;

    // Get the names of all the sdl files
    std::vector<std::wstring> files = plStreamSource::GetInstance()->GetListOfNames(wSDLDir, L".sdl");

    bool ret=true;
    int cnt=0;
    for (int i = 0; i < files.size(); i++)
    {
        char* str = hsWStringToString(files[i].c_str());
        if (!ILoadSDLFile(str))
        {
            plNetApp* netApp = plSDLMgr::GetInstance()->GetNetApp();
            if (netApp)
                netApp->ErrorMsg("Error loading SDL file %s", str);
            else
                hsStatusMessageF("Error loading SDL file %s", str);
            ret=false;
        }
        else
            cnt++;
        delete [] str;
    }
    DebugMsg("Done reading SDL files"); 

    if (!cnt)
        ret=false;

    return ret;
}