Implemented a direct filesystem class for the VFS. It's used as the default filesyste...
[fail.git] / src / vfs / DirectFS.cpp
bloba08599bebe4fecd360744c7fc3d783e0e0b25bc9
1 /*
2 Fail game engine
3 Copyright 2009 Antoine Chavasse <a.chavasse@gmail.com>
5 This file is part of Fail.
7 Fail is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 3
9 as published by the Free Software Foundation.
11 Fail is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "DirectFS.h"
20 #include "io/FileInputStream.h"
21 #include "io/FileOutputStream.h"
23 using namespace fail;
24 using namespace fail::vfs;
26 DirectFS::DirectFS( string BasePath ) :
27 m_BasePath( BasePath )
31 shared_ptr< io::SeekableInputStream > DirectFS::openRead( string filename )
33 string fullpath = m_BasePath + filename;
34 return shared_ptr< io::SeekableInputStream >( new io::FileInputStream( fullpath ) );
37 shared_ptr< io::SeekableOutputStream > DirectFS::openWrite( string filename )
39 string fullpath = m_BasePath + filename;
40 return shared_ptr< io::SeekableOutputStream >( new io::FileOutputStream( fullpath ) );