Crystal Space
Welcome,
Guest
. Please
login
or
register
.
May 21, 2013, 09:10:36 am
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
9224
Posts in
2230
Topics by
5383
Members
Latest Member:
genevakcarter
Crystal Space
Crystal Space Development
Support
vfs question
« previous
next »
Pages:
[
1
]
Author
Topic: vfs question (Read 1534 times)
mirkril
Newbie
Posts: 3
vfs question
«
on:
August 26, 2006, 07:00:56 pm »
I'm trying to load an image using the real path and filename of the file.
I'm using wxFileDialog to get the filename and path, I'm using
iLoader::LoadImage to load the image. The error I'm getting is
the file does not exist on VFS. I looked at viewmesh's source code
to get the basic outline of code.
Here's is the code I'm using:
wxFileDialog dialog(this, caption, default_dir, default_filename, wildcard, wxOPEN | wxFILE_MUST_EXIST);
if(dialog.ShowModal() == wxID_OK)
{
vfs->Mount("/tmp/avocado", dialog.GetDirectory().c_str());
vfs->ChDir("/tmp/avocado");
vfs->PushDir();
csRef<iImage> hm_img = loader->LoadImage(dialog.GetFilename().c_str(), CS_IMGFMT_TRUECOLOR);
if(hm_img == 0)
{
// error handling
}
// do stuff with image
vfs->PopDir();
hm_img = 0;
}
CS version: svn as of aug 25, 2006
OS: linux
Thanks for any help,
Jonathan
Logged
Commander
Newbie
Posts: 15
Re: vfs question
«
Reply #1 on:
August 26, 2006, 09:04:09 pm »
I don't know if that's all, but try calling PushDir() before ChDir().
Good luck!
Logged
mirkril
Newbie
Posts: 3
Re: vfs question
«
Reply #2 on:
August 27, 2006, 01:14:44 am »
Yup, that's a bug. Thanks for pointing it out.
I solved the original problem. I needed to end both the vfs path and the real path
with a file path separator, and the directory that wxFileDialog returns does not end with
a file path separator.
Logged
Pages:
[
1
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Crystal Space Development
-----------------------------
=> General Crystal Space Discussion
=> Support
-----------------------------
Crystal Space Project Development
-----------------------------
=> Feature Requests
=> Plugins
=> Bug Reports
-----------------------------
Crystal Space Development
-----------------------------
=> Game Content Creation
-----------------------------
Miscellaneous
-----------------------------
=> Article/Tutorial Requests
=> Article/Tutorial Discussion
-----------------------------
Crystal Space Project Development
-----------------------------
=> Development Discussion
-----------------------------
Crystal Space Projects
-----------------------------
=> Project Discussion
=> WIP Projects
=> Finished Projects
-----------------------------
Associate Projects
-----------------------------
=> CEL Discussion
=> Crystal Core Discussion
=> CrystalBlend Discussion
-----------------------------
Crystal Space Project Development
-----------------------------
=> Google Summer of Code
-----------------------------
Associate Projects
-----------------------------
=> Apricot (Open Game)
=> Ares Project
Loading...