Invalid file acces on linux

Kali

16-12-2007 16:33:47

The demo application tries to write to certain files it does not have acces to.


QuickGui ConfigScriptSerializer : saving to/usr/local/share/QuickGUI/media/skins/qgui/qgui.skinset
ConfigScriptSerializer : done.
QuickGui ConfigScriptSerializer : saving to/fear.skinset
An exception has occured: OGRE EXCEPTION(0:IOException): Cannot create QuickGUI file. in ConfigScriptSerializer::exportQueued at /home/karel/development/quickgui/QuickGUI/src/QuickGUIConfigScriptParser.cpp (line 411)


It is apparantly trying to create a file in a directory it does not have access to nor should have access to. If you need to write a file on unix systems you need to create it in the /tmp directory if it is only for the current session or in $HOME/.name of appication if you will need it permanently. If you can tell you what it's for I can write a patch if you want.

kungfoomasta

16-12-2007 20:33:08

I will look into this shortly, QuickGUI shouldn't be trying to create the file if it already exists.

Kali

26-12-2007 20:29:31

Just pointing out that the demo still won't run on linux by default without removing the code that tries to create that file.

Just as a point of note fear.skinset does not exist anywhere in the distribution qgui.skinset does at the location specified.

kungfoomasta

26-12-2007 21:52:28

I use the demo as my test bed, I will make sure it is cleaned up before the next official release.

Thanks for reviving this thread, I will look into why files are created when they shouldn't be.

kungfoomasta

26-12-2007 22:04:59

This is the code for the SkinSet Constructor:


// if skinset doesn't exists
if (loadSkin() == false)
{
// assemble texture in a single one
buildTexture();
}

if(!Ogre::MaterialManager::getSingleton().resourceExists(mMaterialName))
buildMaterial();


When I debug, both if statements are not entered, so neither the skinset, the texture, or the material are created. Does the same path of execution occur on your machine?

Kali

26-12-2007 23:41:07

It enters BuildTexture 2 times. once when loading ther qgui skinset, which results in


Quickgui : Adding qgui.scrollbar.vertical.up.over.pngto skinqgui
Quickgui : Adding qgui.trackbar.vertical.slider.down.pngto skinqgui
...
Quickgui : Adding qgui.tree.button.over.pngto skinqgui
QuickGui ConfigScriptSerializer : saving to/usr/local/share/QuickGUI/media/skins/qgui/qgui.skinset
ConfigScriptSerializer : done.


which works fine allthough he is not allowed to write to /usr/local/share/QuickGUI/media/skins/qgui/qgui.skinset.

The a second time when loading the fear skinset which results in


QuickGui ConfigScriptSerializer : saving to/fear.skinset
An exception has occured: OGRE EXCEPTION(0:IOException): Cannot create QuickGUI file. in ConfigScriptSerializer::exportQueued at /home/karel/development/quickgui/QuickGUI/src/QuickGUIConfigScriptParser.cpp (line 411)


The fear skinset which can obviously not be found as there doesn't appear to be a single file with fear in the name in svn.

buildMaterial is not executed.

kungfoomasta

27-12-2007 04:39:20

This means that loadSkin is returning false. Here is the code for the function:


bool SkinSet::loadSkin()
{
ConfigNode *skinRootNode = ConfigScriptLoader::getSingleton().getConfigScript("skinset", mSkinName);
if (skinRootNode)
{
ConfigNode *size = skinRootNode->findChild("size");
if (size)
{
mTextureWidth = Ogre::StringConverter::parseInt(size->getValues()[0]);
mTextureHeight = Ogre::StringConverter::parseInt(size->getValues()[1]);
}

ConfigNode *texName = skinRootNode->findChild("texture");
// If the corresponding skinset image file is not available, return.
Ogre::StringVectorPtr results = Ogre::ResourceGroupManager::getSingleton().findResourceNames(mResourceGroup, mTextureName);
if(results.isNull() || results->empty())
return false;

std::vector<ConfigNode*> children = skinRootNode->getChildren();
std::vector<ConfigNode*>::iterator it;
for (it = children.begin(); it != children.end(); ++it)
{
ConfigNode* currNode = *it;
if (currNode->getName() == "element")
{
const Ogre::String elementName = currNode->getValues()[0];
ConfigNode *dimension = currNode->findChild("dimension");
Ogre::Vector4 texCoord;
if (dimension)
{
texCoord.x = Ogre::StringConverter::parseReal(dimension->getValues()[0]);
texCoord.y = Ogre::StringConverter::parseReal(dimension->getValues()[1]);
texCoord.z = Ogre::StringConverter::parseReal(dimension->getValues()[2]);
texCoord.w = Ogre::StringConverter::parseReal(dimension->getValues()[3]);
}

//ConfigNode *rotation = skinRootNode->findChild("rotation");
//if (rotation)
//{
// rotation.x = Ogre::StringConverter::parseReal(rotation->getValues()[0]);
// rotation.y = Ogre::StringConverter::parseReal(rotation->getValues()[1]);
// rotation.z = Ogre::StringConverter::parseReal(rotation->getValues()[2]);
//}

const Ogre::String texName (mSkinName + "." + elementName + ".png");

mTextureMap[texName] = texCoord;
mContainedTextures.insert(texName);
mTextureNames.push_back(texName);
}
}
mDirtyTexture = false;
mDirtyTextureCoordinates = false;
return true;
}
return false;
}


There are 2 options for why false is returned:
1. No definition for skinset qgui is found. The definition should be inside a .skinset file, and look similar to:

skinset qgui
{
...


2. The corresponding skinset image file is not found. This would be the "SkinSet.qgui.png" file.

It would seem that one or both of these files are not listed within an Ogre defined resource path, according to your execution.