expose filestream stuff

This commit is contained in:
David Rose 2008-10-20 18:24:25 +00:00
parent 4d2ff692c6
commit 65ef4f55da
18 changed files with 260 additions and 114 deletions

View File

@ -1836,7 +1836,7 @@ open_write(ofstream &stream, bool truncate) const {
////////////////////////////////////////////////////////////////////
// Function: Filename::open_append
// Access: Published
// Description: Opens the indicated ifstream for writing the file, if
// Description: Opens the indicated ofstream for writing the file, if
// possible. Returns true if successful, false
// otherwise. This requires the setting of the
// set_text()/set_binary() flags to open the file
@ -1882,12 +1882,16 @@ open_append(ofstream &stream) const {
// set_text() or set_binary().
////////////////////////////////////////////////////////////////////
bool Filename::
open_read_write(fstream &stream) const {
open_read_write(fstream &stream, bool truncate) const {
assert(!get_pattern());
assert(is_text() || is_binary());
ios_openmode open_mode = ios::out | ios::in;
if (truncate) {
open_mode |= ios::trunc;
}
// Since ios::in also seems to imply ios::nocreate (!), we must
// guarantee the file already exists before we try to open it.
if (!exists()) {
@ -1913,6 +1917,44 @@ open_read_write(fstream &stream) const {
return (!stream.fail());
}
////////////////////////////////////////////////////////////////////
// Function: Filename::open_read_append
// Access: Published
// Description: Opens the indicated ifstream for reading and writing
// the file, if possible; writes are appended to the end
// of the file. Returns true if successful, false
// otherwise. This requires the setting of the
// set_text()/set_binary() flags to open the file
// appropriately as indicated; it is an error to call
// open_read() without first calling one of set_text()
// or set_binary().
////////////////////////////////////////////////////////////////////
bool Filename::
open_read_append(fstream &stream) const {
assert(!get_pattern());
assert(is_text() || is_binary());
ios_openmode open_mode = ios::app | ios::in;
#ifdef HAVE_IOS_BINARY
// For some reason, some systems (like Irix) don't define
// ios::binary.
if (!is_text()) {
open_mode |= ios::binary;
}
#endif
stream.clear();
string os_specific = to_os_specific();
#ifdef HAVE_OPEN_MASK
stream.open(os_specific.c_str(), open_mode, 0666);
#else
stream.open(os_specific.c_str(), open_mode);
#endif
return (!stream.fail());
}
#ifdef USE_PANDAFILESTREAM
////////////////////////////////////////////////////////////////////
// Function: Filename::open_read
@ -2047,7 +2089,7 @@ open_append(pofstream &stream) const {
////////////////////////////////////////////////////////////////////
// Function: Filename::open_read_write
// Access: Published
// Description: Opens the indicated pfstream for read/write access to
// Description: Opens the indicated fstream for read/write access to
// the file, if possible. Returns true if successful,
// false otherwise. This requires the setting of the
// set_text()/set_binary() flags to open the file
@ -2056,12 +2098,16 @@ open_append(pofstream &stream) const {
// set_text() or set_binary().
////////////////////////////////////////////////////////////////////
bool Filename::
open_read_write(pfstream &stream) const {
open_read_write(pfstream &stream, bool truncate) const {
assert(!get_pattern());
assert(is_text() || is_binary());
ios_openmode open_mode = ios::out | ios::in;
if (truncate) {
open_mode |= ios::trunc;
}
// Since ios::in also seems to imply ios::nocreate (!), we must
// guarantee the file already exists before we try to open it.
if (!exists()) {
@ -2088,6 +2134,46 @@ open_read_write(pfstream &stream) const {
}
#endif // USE_PANDAFILESTREAM
#ifdef USE_PANDAFILESTREAM
////////////////////////////////////////////////////////////////////
// Function: Filename::open_read_append
// Access: Published
// Description: Opens the indicated pfstream for reading and writing
// the file, if possible; writes are appended to the end
// of the file. Returns true if successful, false
// otherwise. This requires the setting of the
// set_text()/set_binary() flags to open the file
// appropriately as indicated; it is an error to call
// open_read() without first calling one of set_text()
// or set_binary().
////////////////////////////////////////////////////////////////////
bool Filename::
open_read_append(pfstream &stream) const {
assert(!get_pattern());
assert(is_text() || is_binary());
ios_openmode open_mode = ios::app | ios::in;
#ifdef HAVE_IOS_BINARY
// For some reason, some systems (like Irix) don't define
// ios::binary.
if (!is_text()) {
open_mode |= ios::binary;
}
#endif
stream.clear();
string os_specific = to_os_specific();
#ifdef HAVE_OPEN_MASK
stream.open(os_specific.c_str(), open_mode, 0666);
#else
stream.open(os_specific.c_str(), open_mode);
#endif
return (!stream.fail());
}
#endif // USE_PANDAFILESTREAM
////////////////////////////////////////////////////////////////////
// Function: Filename::touch
// Access: Published
@ -2165,8 +2251,8 @@ touch() const {
// Other systems may not have an explicit control over the
// modification time. For these systems, we'll just temporarily
// open the file in append mode, then close it again (it gets closed
// when the ofstream goes out of scope).
ofstream file;
// when the pfstream goes out of scope).
pfstream file;
return open_append(file);
#endif // WIN32, HAVE_UTIME_H
}

View File

@ -178,13 +178,15 @@ PUBLISHED:
bool open_read(ifstream &stream) const;
bool open_write(ofstream &stream, bool truncate = true) const;
bool open_append(ofstream &stream) const;
bool open_read_write(fstream &stream) const;
bool open_read_write(fstream &stream, bool truncate = false) const;
bool open_read_append(fstream &stream) const;
#ifdef USE_PANDAFILESTREAM
bool open_read(pifstream &stream) const;
bool open_write(pofstream &stream, bool truncate = true) const;
bool open_append(pofstream &stream) const;
bool open_read_write(pfstream &stream) const;
bool open_read_write(pfstream &stream, bool truncate = false) const;
bool open_read_append(pfstream &stream) const;
#endif // USE_PANDAFILESTREAM
bool chdir() const;

View File

@ -372,7 +372,8 @@ sync() {
write_chars(pbase(), n);
pbump(-(int)n);
}
_dest->flush();
return 0;
}

View File

@ -28,7 +28,7 @@
// IDecompressStream and OCompressStream.
////////////////////////////////////////////////////////////////////
class EXPCL_DTOOLCONFIG EncryptStreamBuf : public streambuf {
public:
PUBLISHED:
EncryptStreamBuf();
virtual ~EncryptStreamBuf();

View File

@ -38,37 +38,37 @@ PUBLISHED:
INLINE istream *get_istream() const;
INLINE bool get_bool();
INLINE PN_int8 get_int8();
INLINE PN_uint8 get_uint8();
BLOCKING INLINE bool get_bool();
BLOCKING INLINE PN_int8 get_int8();
BLOCKING INLINE PN_uint8 get_uint8();
INLINE PN_int16 get_int16();
INLINE PN_int32 get_int32();
INLINE PN_int64 get_int64();
INLINE PN_uint16 get_uint16();
INLINE PN_uint32 get_uint32();
INLINE PN_uint64 get_uint64();
INLINE float get_float32();
INLINE PN_float64 get_float64();
BLOCKING INLINE PN_int16 get_int16();
BLOCKING INLINE PN_int32 get_int32();
BLOCKING INLINE PN_int64 get_int64();
BLOCKING INLINE PN_uint16 get_uint16();
BLOCKING INLINE PN_uint32 get_uint32();
BLOCKING INLINE PN_uint64 get_uint64();
BLOCKING INLINE float get_float32();
BLOCKING INLINE PN_float64 get_float64();
INLINE PN_int16 get_be_int16();
INLINE PN_int32 get_be_int32();
INLINE PN_int64 get_be_int64();
INLINE PN_uint16 get_be_uint16();
INLINE PN_uint32 get_be_uint32();
INLINE PN_uint64 get_be_uint64();
INLINE float get_be_float32();
INLINE PN_float64 get_be_float64();
BLOCKING INLINE PN_int16 get_be_int16();
BLOCKING INLINE PN_int32 get_be_int32();
BLOCKING INLINE PN_int64 get_be_int64();
BLOCKING INLINE PN_uint16 get_be_uint16();
BLOCKING INLINE PN_uint32 get_be_uint32();
BLOCKING INLINE PN_uint64 get_be_uint64();
BLOCKING INLINE float get_be_float32();
BLOCKING INLINE PN_float64 get_be_float64();
string get_string();
string get_string32();
string get_z_string();
string get_fixed_string(size_t size);
BLOCKING string get_string();
BLOCKING string get_string32();
BLOCKING string get_z_string();
BLOCKING string get_fixed_string(size_t size);
void skip_bytes(size_t size);
string extract_bytes(size_t size);
BLOCKING void skip_bytes(size_t size);
BLOCKING string extract_bytes(size_t size);
string readline();
BLOCKING string readline();
private:
istream *_in;

View File

@ -27,7 +27,7 @@ StreamWriter(ostream &out) :
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::Constructor
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE StreamWriter::
@ -39,7 +39,7 @@ StreamWriter(ostream *out, bool owns_stream) :
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::Copy Constructor
// Access: Public
// Access: Published
// Description: The copy constructor does not copy ownership of the
// stream.
////////////////////////////////////////////////////////////////////
@ -52,7 +52,7 @@ StreamWriter(const StreamWriter &copy) :
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::Copy Assignment Operator
// Access: Public
// Access: Published
// Description: The copy constructor does not copy ownership of the
// stream.
////////////////////////////////////////////////////////////////////
@ -67,7 +67,7 @@ operator = (const StreamWriter &copy) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::Destructor
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE StreamWriter::
@ -79,7 +79,7 @@ INLINE StreamWriter::
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::get_ostream
// Access: Public
// Access: Published
// Description: Returns the stream in use.
////////////////////////////////////////////////////////////////////
INLINE ostream *StreamWriter::
@ -89,7 +89,7 @@ get_ostream() const {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_bool
// Access: Public
// Access: Published
// Description: Adds a boolean value to the stream.
////////////////////////////////////////////////////////////////////
INLINE void StreamWriter::
@ -99,7 +99,7 @@ add_bool(bool b) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_int8
// Access: Public
// Access: Published
// Description: Adds a signed 8-bit integer to the stream.
////////////////////////////////////////////////////////////////////
INLINE void StreamWriter::
@ -109,7 +109,7 @@ add_int8(PN_int8 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_uint8
// Access: Public
// Access: Published
// Description: Adds an unsigned 8-bit integer to the stream.
////////////////////////////////////////////////////////////////////
INLINE void StreamWriter::
@ -119,7 +119,7 @@ add_uint8(PN_uint8 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_int16
// Access: Public
// Access: Published
// Description: Adds a signed 16-bit integer to the stream.
////////////////////////////////////////////////////////////////////
INLINE void StreamWriter::
@ -130,7 +130,7 @@ add_int16(PN_int16 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_int32
// Access: Public
// Access: Published
// Description: Adds a signed 32-bit integer to the stream.
////////////////////////////////////////////////////////////////////
INLINE void StreamWriter::
@ -141,7 +141,7 @@ add_int32(PN_int32 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_int64
// Access: Public
// Access: Published
// Description: Adds a signed 64-bit integer to the stream.
////////////////////////////////////////////////////////////////////
INLINE void StreamWriter::
@ -152,7 +152,7 @@ add_int64(PN_int64 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_uint16
// Access: Public
// Access: Published
// Description: Adds an unsigned 16-bit integer to the stream.
////////////////////////////////////////////////////////////////////
INLINE void StreamWriter::
@ -163,7 +163,7 @@ add_uint16(PN_uint16 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_uint32
// Access: Public
// Access: Published
// Description: Adds an unsigned 32-bit integer to the stream.
////////////////////////////////////////////////////////////////////
INLINE void StreamWriter::
@ -174,7 +174,7 @@ add_uint32(PN_uint32 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_uint64
// Access: Public
// Access: Published
// Description: Adds an unsigned 64-bit integer to the stream.
////////////////////////////////////////////////////////////////////
INLINE void StreamWriter::
@ -185,7 +185,7 @@ add_uint64(PN_uint64 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_float32
// Access: Public
// Access: Published
// Description: Adds a 32-bit single-precision floating-point number
// to the stream. Since this kind of float is not
// necessarily portable across different architectures,
@ -203,7 +203,7 @@ add_float32(float value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_float64
// Access: Public
// Access: Published
// Description: Adds a 64-bit floating-point number to the stream.
////////////////////////////////////////////////////////////////////
INLINE void StreamWriter::
@ -214,7 +214,7 @@ add_float64(PN_float64 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_be_int16
// Access: Public
// Access: Published
// Description: Adds a signed 16-bit big-endian integer to the
// streamWriter.
////////////////////////////////////////////////////////////////////
@ -226,7 +226,7 @@ add_be_int16(PN_int16 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_be_int32
// Access: Public
// Access: Published
// Description: Adds a signed 32-bit big-endian integer to the
// streamWriter.
////////////////////////////////////////////////////////////////////
@ -238,7 +238,7 @@ add_be_int32(PN_int32 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_be_int64
// Access: Public
// Access: Published
// Description: Adds a signed 64-bit big-endian integer to the
// streamWriter.
////////////////////////////////////////////////////////////////////
@ -250,7 +250,7 @@ add_be_int64(PN_int64 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_be_uint16
// Access: Public
// Access: Published
// Description: Adds an unsigned 16-bit big-endian integer to the
// streamWriter.
////////////////////////////////////////////////////////////////////
@ -262,7 +262,7 @@ add_be_uint16(PN_uint16 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_be_uint32
// Access: Public
// Access: Published
// Description: Adds an unsigned 32-bit big-endian integer to the
// streamWriter.
////////////////////////////////////////////////////////////////////
@ -274,7 +274,7 @@ add_be_uint32(PN_uint32 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_be_uint64
// Access: Public
// Access: Published
// Description: Adds an unsigned 64-bit big-endian integer to the
// streamWriter.
////////////////////////////////////////////////////////////////////
@ -286,7 +286,7 @@ add_be_uint64(PN_uint64 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_be_float32
// Access: Public
// Access: Published
// Description: Adds a 32-bit single-precision big-endian
// floating-point number to the stream. Since this
// kind of float is not necessarily portable across
@ -304,7 +304,7 @@ add_be_float32(float value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_be_float64
// Access: Public
// Access: Published
// Description: Adds a 64-bit big-endian floating-point number to the
// streamWriter.
////////////////////////////////////////////////////////////////////
@ -316,7 +316,7 @@ add_be_float64(PN_float64 value) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_string
// Access: Public
// Access: Published
// Description: Adds a variable-length string to the stream. This
// actually adds a count followed by n bytes.
////////////////////////////////////////////////////////////////////
@ -334,7 +334,7 @@ add_string(const string &str) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_string32
// Access: Public
// Access: Published
// Description: Adds a variable-length string to the stream, using a
// 32-bit length field.
////////////////////////////////////////////////////////////////////
@ -349,7 +349,7 @@ add_string32(const string &str) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_z_string
// Access: Public
// Access: Published
// Description: Adds a variable-length string to the stream, as a
// NULL-terminated string.
////////////////////////////////////////////////////////////////////
@ -366,7 +366,7 @@ add_z_string(string str) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::add_fixed_string
// Access: Public
// Access: Published
// Description: Adds a fixed-length string to the stream. If the
// string given is less than the requested size, this
// will pad the string out with zeroes; if it is greater
@ -386,7 +386,7 @@ add_fixed_string(const string &str, size_t size) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::append_data
// Access: Public
// Access: Published
// Description: Appends some more raw data to the end of the
// streamWriter.
////////////////////////////////////////////////////////////////////
@ -397,7 +397,7 @@ append_data(const void *data, size_t size) {
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::append_data
// Access: Public
// Access: Published
// Description: Appends some more raw data to the end of the
// streamWriter.
////////////////////////////////////////////////////////////////////
@ -405,3 +405,13 @@ INLINE void StreamWriter::
append_data(const string &data) {
append_data(data.data(), data.length());
}
////////////////////////////////////////////////////////////////////
// Function: StreamWriter::flush
// Access: Published
// Description: Calls flush() on the underlying stream.
////////////////////////////////////////////////////////////////////
INLINE void StreamWriter::
flush() {
_out->flush();
}

View File

@ -41,38 +41,40 @@ PUBLISHED:
INLINE ostream *get_ostream() const;
INLINE void add_bool(bool value);
INLINE void add_int8(PN_int8 value);
INLINE void add_uint8(PN_uint8 value);
BLOCKING INLINE void add_bool(bool value);
BLOCKING INLINE void add_int8(PN_int8 value);
BLOCKING INLINE void add_uint8(PN_uint8 value);
// The default numeric packing is little-endian.
INLINE void add_int16(PN_int16 value);
INLINE void add_int32(PN_int32 value);
INLINE void add_int64(PN_int64 value);
INLINE void add_uint16(PN_uint16 value);
INLINE void add_uint32(PN_uint32 value);
INLINE void add_uint64(PN_uint64 value);
INLINE void add_float32(float value);
INLINE void add_float64(PN_float64 value);
BLOCKING INLINE void add_int16(PN_int16 value);
BLOCKING INLINE void add_int32(PN_int32 value);
BLOCKING INLINE void add_int64(PN_int64 value);
BLOCKING INLINE void add_uint16(PN_uint16 value);
BLOCKING INLINE void add_uint32(PN_uint32 value);
BLOCKING INLINE void add_uint64(PN_uint64 value);
BLOCKING INLINE void add_float32(float value);
BLOCKING INLINE void add_float64(PN_float64 value);
// These functions pack numbers big-endian, in case that's desired.
INLINE void add_be_int16(PN_int16 value);
INLINE void add_be_int32(PN_int32 value);
INLINE void add_be_int64(PN_int64 value);
INLINE void add_be_uint16(PN_uint16 value);
INLINE void add_be_uint32(PN_uint32 value);
INLINE void add_be_uint64(PN_uint64 value);
INLINE void add_be_float32(float value);
INLINE void add_be_float64(PN_float64 value);
BLOCKING INLINE void add_be_int16(PN_int16 value);
BLOCKING INLINE void add_be_int32(PN_int32 value);
BLOCKING INLINE void add_be_int64(PN_int64 value);
BLOCKING INLINE void add_be_uint16(PN_uint16 value);
BLOCKING INLINE void add_be_uint32(PN_uint32 value);
BLOCKING INLINE void add_be_uint64(PN_uint64 value);
BLOCKING INLINE void add_be_float32(float value);
BLOCKING INLINE void add_be_float64(PN_float64 value);
INLINE void add_string(const string &str);
INLINE void add_string32(const string &str);
INLINE void add_z_string(string str);
INLINE void add_fixed_string(const string &str, size_t size);
BLOCKING INLINE void add_string(const string &str);
BLOCKING INLINE void add_string32(const string &str);
BLOCKING INLINE void add_z_string(string str);
BLOCKING INLINE void add_fixed_string(const string &str, size_t size);
void pad_bytes(size_t size);
INLINE void append_data(const void *data, size_t size);
INLINE void append_data(const string &data);
BLOCKING void pad_bytes(size_t size);
BLOCKING INLINE void append_data(const void *data, size_t size);
BLOCKING INLINE void append_data(const string &data);
BLOCKING INLINE void flush();
private:
ostream *_out;

View File

@ -170,6 +170,8 @@ set_active(bool active) {
// ...we're pausing a looping sound.
_paused = true;
}
_start_time = get_time();
_got_start_time = true;
stop();
}
}

View File

@ -19,6 +19,7 @@
dcast.T dcast.h \
encrypt_string.h \
error_utils.h \
export_dtool.h \
hashGeneratorBase.I hashGeneratorBase.h \
hashVal.I hashVal.h \
indirectLess.I indirectLess.h \

View File

@ -16,6 +16,8 @@ forcetype NeverFreeMemory
forcetype IFileStream
forcetype OFileStream
forcetype FileStream
forcetype IDecryptStream
forcetype OEncryptStream
forcetype ConfigExpress
renametype ConfigExpress ConfigExpress

View File

@ -28,7 +28,7 @@
#include "pandaSystem.h"
#include "numeric_types.h"
#include "namable.h"
#include "export_dtool.h"
#include "dconfig.h"
ConfigureDef(config_express);

View File

@ -19,25 +19,8 @@
#include "notifyCategoryProxy.h"
#include "dconfig.h"
// We include these files to force them to be instrumented by
// interrogate.
#include "pandaSystem.h"
#include "globPattern.h"
#include "pandaFileStream.h"
#include "configFlags.h"
#include "configPage.h"
#include "configPageManager.h"
#include "configVariable.h"
#include "configVariableBase.h"
#include "configVariableBool.h"
#include "configVariableDouble.h"
#include "configVariableFilename.h"
#include "configVariableInt.h"
#include "configVariableInt64.h"
#include "configVariableList.h"
#include "configVariableManager.h"
#include "configVariableSearchPath.h"
#include "configVariableString.h"
ConfigureDecl(config_express, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS);
NotifyCategoryDecl(express, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS);

View File

@ -0,0 +1,44 @@
// Filename: export_dtool.h
// Created by: drose (15Oct08)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef EXPORT_DTOOL_H
#define EXPORT_DTOOL_H
// This header file exists to import the symbols necessary to publish
// all of the classes defined in the dtool source tree. (These must
// be published here, instead of within dtool itself, since
// interrogate is not run on dtool.)
#include "pandabase.h"
#include "pandaSystem.h"
#include "globPattern.h"
#include "pandaFileStream.h"
#include "encryptStream.h"
#include "configFlags.h"
#include "configPage.h"
#include "configPageManager.h"
#include "configVariable.h"
#include "configVariableBase.h"
#include "configVariableBool.h"
#include "configVariableDouble.h"
#include "configVariableFilename.h"
#include "configVariableInt.h"
#include "configVariableInt64.h"
#include "configVariableList.h"
#include "configVariableManager.h"
#include "configVariableSearchPath.h"
#include "configVariableString.h"
#endif

View File

@ -102,7 +102,11 @@ open_read_file(const Filename &file) const {
}
#endif // WIN32
Filename pathname(_physical_filename, file);
pathname.set_binary();
if (file.is_text()) {
pathname.set_text();
} else {
pathname.set_binary();
}
pifstream *stream = new pifstream;
if (!pathname.open_read(*stream)) {
// Couldn't open the file for some reason.

View File

@ -285,6 +285,9 @@ get_file(const Filename &filename) const {
Filename pathname(filename);
if (pathname.is_local()) {
pathname = Filename(_cwd, filename);
if (filename.is_text()) {
pathname.set_text();
}
}
pathname.standardize();
string strpath = pathname.get_filename_index(0).get_fullpath().substr(1);
@ -720,7 +723,11 @@ found_match(PT(VirtualFile) &found_file, VirtualFileComposite *&composite_file,
const Filename &original_filename, bool implicit_pz_file) const {
if (found_file == (VirtualFile *)NULL) {
// This was our first match. Save it.
found_file = new VirtualFileSimple(mount, local_filename, implicit_pz_file);
Filename local(local_filename);
if (original_filename.is_text()) {
local.set_text();
}
found_file = new VirtualFileSimple(mount, local, implicit_pz_file);
found_file->set_original_filename(original_filename);
if (!mount->is_directory(local_filename)) {
// If it's not a directory, we're done.

View File

@ -35,7 +35,7 @@
// Seeking is not supported.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS IDecompressStream : public istream {
public:
PUBLISHED:
INLINE IDecompressStream();
INLINE IDecompressStream(istream *source, bool owns_source);
@ -59,7 +59,7 @@ private:
// Seeking is not supported.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS OCompressStream : public ostream {
public:
PUBLISHED:
INLINE OCompressStream();
INLINE OCompressStream(ostream *dest, bool owns_dest,
int compression_level = 6);

View File

@ -219,6 +219,7 @@ sync() {
pbump(-(int)n);
}
_dest->flush();
return 0;
}

View File

@ -23,6 +23,7 @@
#include "string_utils.h"
#include "configVariableInt.h"
#include "configVariableString.h"
#include "configVariableFilename.h"
BamCache *BamCache::_global_ptr = NULL;