source: trunk/src/io/c_file_system.cc @ 395

Last change on this file since 395 was 395, checked in by epyon, 10 years ago
  • bulk update copyright update include guards cleanup core/common.hh -> common.hh minor cleanups
File size: 857 bytes
RevLine 
[395]1// Copyright (C) 2012-2015 ChaosForge Ltd
2// http://chaosforge.org/
3//
4// This file is part of Nova libraries.
5// For conditions of distribution and use, see copying.txt file in root folder.
[124]6
7#include "nv/io/c_file_system.hh"
8#include "nv/io/c_stream.hh"
[395]9#include <cstdio>
[124]10
11using namespace nv;
12
13c_file_system::c_file_system()
14{
15
16}
17
18c_file_system::~c_file_system()
19{
20
21}
22
23bool c_file_system::exists( const char* fpath )
24{
25        FILE* file = ::fopen( fpath, "rb" );
26        if ( !file )
27        {
28                return false;
29        }
30        ::fclose( file );
31        return true;
32}
33
34stream* c_file_system::open( const char* fpath, const char* fmode /*= "rb" */ )
35{
[128]36        NV_ASSERT( fpath != nullptr && fmode != nullptr, "Bad parameters passed to open" );
[124]37        FILE* file = ::fopen( fpath, fmode );
38        if ( !file )
39        {
40                return nullptr;
41        }
42        return new c_stream( file, fpath );
43}
Note: See TracBrowser for help on using the repository browser.