From: <ki...@us...> - 2011-11-29 16:21:10
|
Revision: 37156 http://crystal.svn.sourceforge.net/crystal/?rev=37156&view=rev Author: kickvb Date: 2011-11-29 16:21:03 +0000 (Tue, 29 Nov 2011) Log Message: ----------- - Fixed loading of file paths that are relative to a mounted real path - Fixed display of an invalid texture shader variable - More CS::Quote and space character cleansing Modified Paths: -------------- CS/trunk/apps/tools/viewmesh/materialtab.h CS/trunk/apps/tools/viewmesh/viewmesh.cpp Modified: CS/trunk/apps/tools/viewmesh/materialtab.h =================================================================== --- CS/trunk/apps/tools/viewmesh/materialtab.h 2011-11-29 14:33:26 UTC (rev 37155) +++ CS/trunk/apps/tools/viewmesh/materialtab.h 2011-11-29 16:21:03 UTC (rev 37156) @@ -145,8 +145,9 @@ { iTextureWrapper* tex; sv->GetValue(tex); + csString name = tex ? tex->QueryObject()->GetName() : "not found"; - AddSVItem(i, svstrings->Request(sv->GetName()), tex->QueryObject()->GetName()); + AddSVItem(i, svstrings->Request(sv->GetName()), name); break; } case csShaderVariable::INT: Modified: CS/trunk/apps/tools/viewmesh/viewmesh.cpp =================================================================== --- CS/trunk/apps/tools/viewmesh/viewmesh.cpp 2011-11-29 14:33:26 UTC (rev 37155) +++ CS/trunk/apps/tools/viewmesh/viewmesh.cpp 2011-11-29 16:21:03 UTC (rev 37156) @@ -184,25 +184,37 @@ { if (!loader->LoadLibraryFile (libname)) { - ReportError("Couldn't load lib %s.\n", libname); + ReportError("Couldn't load lib %s.\n", CS::Quote::Single (libname)); } } csString meshfilename = cmdline->GetName (0); const char* texturefilename = cmdline->GetName (1); const char* texturename = cmdline->GetName (2); - const char* scaleTxt = cmdline->GetOption("Scale"); - const char* realPath = cmdline->GetOption("R"); + const char* scaleTxt = cmdline->GetOption ("Scale"); + const char* realPath = cmdline->GetOption ("R"); - csString vfsDir = cmdline->GetOption("C"); + csString vfsDir = cmdline->GetOption ("C"); if (realPath) { - vfs->Mount ("/tmp/viewmesh", realPath); - vfs->ChDir ("/tmp/viewmesh"); + const char* tempPath = "/tmp/viewmesh"; + + if (!vfs->Exists (realPath)) + ReportError ("Could not find the real path to be mounted %s\n", + CS::Quote::Single (realPath)); + + else + { + vfs->Mount (tempPath, realPath); + vfs->ChDir (tempPath); + + if (vfsDir.IsEmpty ()) + vfsDir = tempPath; + } } - if (vfsDir.IsEmpty() && meshfilename) + if (vfsDir.IsEmpty () && meshfilename) { size_t index = meshfilename.FindLast ('/'); if (index != (size_t) -1) @@ -212,37 +224,38 @@ } } - if (!vfsDir.IsEmpty()) + if (!vfsDir.IsEmpty ()) { if (!vfs->ChDir (vfsDir)) { - ReportError("Cannot change to path: %s\n", vfsDir.GetData ()); + ReportError ("Cannot change to path %s\n", + CS::Quote::Single (vfsDir.GetData ())); } else { // Update StdDlg path. CEGUI::WindowManager* winMgr = cegui->GetWindowManagerPtr (); - CEGUI::Window* window = winMgr->getWindow("StdDlg/Path"); - window->setProperty("Text", vfs->GetCwd()); - StdDlgUpdateLists(vfs->GetCwd()); + CEGUI::Window* window = winMgr->getWindow ("StdDlg/Path"); + window->setProperty ("Text", vfs->GetCwd ()); + StdDlgUpdateLists (vfs->GetCwd ()); } } if (texturefilename && texturename) { - LoadTexture(texturefilename, texturename); + LoadTexture (texturefilename, texturename); } if (meshfilename) { - LoadSprite(meshfilename); + LoadSprite (meshfilename); } if (scaleTxt != 0) { float newScale; csScanStr (scaleTxt, "%f", &newScale); - ScaleSprite(newScale); + ScaleSprite (newScale); } } @@ -935,7 +948,7 @@ CEGUI::String text = item->getText(); if (text.empty()) return CS_EVENT_HANDLED; - csPrintf("cd %s\n",text.c_str()); + csPrintf("cd %s\n", CS::Quote::Single (text.c_str())); CEGUI::Window* inputpath = winMgr->getWindow("StdDlg/Path"); CEGUI::String path = inputpath->getProperty("Text"); @@ -971,7 +984,7 @@ CEGUI::String path = inputpath->getProperty("Text"); if (path.empty()) return CS_EVENT_HANDLED; - csPrintf("cd %s\n",path.c_str()); + csPrintf("cd %s\n", CS::Quote::Single (path.c_str())); vfs->ChDir (path.c_str ()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |