Move GUI schemas to the mod mod. Fix some validation related errors in the mod mod.
Check if the used directory exists before trying to add a validator. Refs #245. This was SVN commit r16773.
This commit is contained in:
parent
7887734ef0
commit
8380b67f94
@ -37,7 +37,7 @@ CMaterialManager::CMaterialManager()
|
||||
CFG_GET_VAL("materialmgr.quality", qualityLevel);
|
||||
qualityLevel = clamp(qualityLevel, 0.0f, 10.0f);
|
||||
|
||||
if (!CXeromyces::AddValidator(g_VFS, "material", "art/materials/material.rng"))
|
||||
if (VfsDirectoryExists(L"art/materials/") && !CXeromyces::AddValidator(g_VFS, "material", "art/materials/material.rng"))
|
||||
LOGERROR("CMaterialManager: failed to load grammar file 'art/materials/material.rng'");
|
||||
}
|
||||
|
||||
|
@ -35,9 +35,11 @@
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
|
||||
CTerrainTextureManager::CTerrainTextureManager():
|
||||
m_LastGroupIndex(0)
|
||||
CTerrainTextureManager::CTerrainTextureManager()
|
||||
: m_LastGroupIndex(0)
|
||||
{
|
||||
if (!VfsDirectoryExists(L"art/terrains/"))
|
||||
return;
|
||||
if (!CXeromyces::AddValidator(g_VFS, "terrain", "art/terrains/terrain.rng"))
|
||||
LOGERROR("CTerrainTextureManager: failed to load grammar file 'art/terrains/terrain.rng'");
|
||||
if (!CXeromyces::AddValidator(g_VFS, "terrain_texture", "art/terrains/terrain_texture.rng"))
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2014 Wildfire Games.
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -35,6 +35,12 @@ bool VfsFileExists(const VfsPath& pathname)
|
||||
return g_VFS->GetFileInfo(pathname, 0) == INFO::OK;
|
||||
}
|
||||
|
||||
bool VfsDirectoryExists(const VfsPath& pathname)
|
||||
{
|
||||
ENSURE(pathname.IsDirectory());
|
||||
return g_VFS->GetDirectoryEntries(pathname, NULL, NULL) == INFO::OK;
|
||||
}
|
||||
|
||||
void RegisterFileReloadFunc(FileReloadFunc func, void* obj)
|
||||
{
|
||||
g_ReloadFuncs.push_back(std::make_pair(func, obj));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2014 Wildfire Games.
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -30,6 +30,8 @@ extern PIVFS g_VFS;
|
||||
|
||||
extern bool VfsFileExists(const VfsPath& pathname);
|
||||
|
||||
extern bool VfsDirectoryExists(const VfsPath& pathname);
|
||||
|
||||
/**
|
||||
* callback function type for file change notifications
|
||||
*/
|
||||
|
@ -1075,7 +1075,8 @@ void InitGraphics(const CmdLineArgs& args, int flags)
|
||||
ogl_WarnIfError();
|
||||
|
||||
// TODO: Is this the best place for this?
|
||||
CXeromyces::AddValidator(g_VFS, "map", "maps/scenario.rng");
|
||||
if (VfsDirectoryExists(L"maps/"))
|
||||
CXeromyces::AddValidator(g_VFS, "map", "maps/scenario.rng");
|
||||
|
||||
try
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user