| 18 | } |
| 19 | |
| 20 | bool Pak::create( const std::string& path ) { |
| 21 | if ( !FileSystem::fileExists( path ) ) { |
| 22 | pakFile Pak; |
| 23 | |
| 24 | Pak.header.head[0] = 'P'; |
| 25 | Pak.header.head[1] = 'A'; |
| 26 | Pak.header.head[2] = 'C'; |
| 27 | Pak.header.head[3] = 'K'; |
| 28 | |
| 29 | Pak.header.dir_offset = sizeof( Pak.header.head ) + 1; |
| 30 | Pak.header.dir_length = 1; |
| 31 | |
| 32 | eeSAFE_DELETE( mPak.fs ); |
| 33 | |
| 34 | mPak.fs = IOStreamFile::New( path, "wb" ); // Open the PAK file |
| 35 | |
| 36 | mPak.fs->write( reinterpret_cast<const char*>( &Pak.header ), sizeof( Pak.header ) ); |
| 37 | |
| 38 | eeSAFE_DELETE( mPak.fs ); |
| 39 | |
| 40 | open( path ); |
| 41 | |
| 42 | return true; |
| 43 | } else { |
| 44 | return open( path ); |
| 45 | } |
| 46 | |
| 47 | return false; |
| 48 | } |
| 49 | |
| 50 | bool Pak::open( const std::string& path ) { |
| 51 | if ( FileSystem::fileExists( path ) ) { |
no test coverage detected