| 824 | //----------------------------------------------------------------------------- |
| 825 | |
| 826 | bool ZipArchive::addFile(const char *filename, const char *pathInZip, bool replace /* = true */) |
| 827 | { |
| 828 | FileStream f; |
| 829 | if (!f.open(filename, Torque::FS::File::Read)) |
| 830 | return false; |
| 831 | |
| 832 | const CentralDir *cd = findFileInfo(pathInZip); |
| 833 | if(! replace && cd && (cd->mInternalFlags & CDFileDeleted) == 0) |
| 834 | return false; |
| 835 | |
| 836 | Stream *dest = openFile(pathInZip, Write); |
| 837 | if(dest == NULL) |
| 838 | { |
| 839 | f.close(); |
| 840 | return false; |
| 841 | } |
| 842 | |
| 843 | bool ret = dest->copyFrom(&f); |
| 844 | |
| 845 | closeFile(dest); |
| 846 | f.close(); |
| 847 | |
| 848 | return ret; |
| 849 | } |
| 850 | |
| 851 | bool ZipArchive::extractFile(const char *pathInZip, const char *filename, bool *crcFail /* = NULL */) |
| 852 | { |