Last change
on this file since 422 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
|
Line | |
---|
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.
|
---|
6 |
|
---|
7 | #include "nv/io/c_file_system.hh"
|
---|
8 | #include "nv/io/c_stream.hh"
|
---|
9 | #include <cstdio>
|
---|
10 |
|
---|
11 | using namespace nv;
|
---|
12 |
|
---|
13 | c_file_system::c_file_system()
|
---|
14 | {
|
---|
15 |
|
---|
16 | }
|
---|
17 |
|
---|
18 | c_file_system::~c_file_system()
|
---|
19 | {
|
---|
20 |
|
---|
21 | }
|
---|
22 |
|
---|
23 | bool 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 |
|
---|
34 | stream* c_file_system::open( const char* fpath, const char* fmode /*= "rb" */ )
|
---|
35 | {
|
---|
36 | NV_ASSERT( fpath != nullptr && fmode != nullptr, "Bad parameters passed to open" );
|
---|
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.