浏览代码

*** empty log message ***

David Rose 25 年之前
父节点
当前提交
192dbfe946

+ 2 - 2
direct/src/dcparse/dcparse.cxx

@@ -3,8 +3,8 @@
 // 
 ////////////////////////////////////////////////////////////////////
 
-#include "dcbase.h"
-#include "dcFile.h"
+#include <dcbase.h>
+#include <dcFile.h>
 
 int
 main(int argc, char *argv[]) {

+ 22 - 4
direct/src/dcparser/dcFile.cxx

@@ -7,6 +7,10 @@
 #include "dcParserDefs.h"
 #include "dcLexerDefs.h"
 
+#ifdef WITHIN_PANDA
+#include <filename.h>
+#endif
+
 
 ////////////////////////////////////////////////////////////////////
 //     Function: DCFile::Constructor
@@ -43,8 +47,15 @@ DCFile::
 //               have been partially read).
 ////////////////////////////////////////////////////////////////////
 bool DCFile::
-read(const string &filename) {
-  ifstream in(filename.c_str());
+read(Filename filename) {
+  ifstream in;
+
+#ifdef WITHIN_PANDA
+  filename.set_text();
+  filename.open_read(in);
+#else
+  in.open(filename.c_str());
+#endif
 
   if (!in) {
     cerr << "Cannot open " << filename << " for reading.\n";
@@ -90,8 +101,15 @@ read(istream &in, const string &filename) {
 //               written, false otherwise.
 ////////////////////////////////////////////////////////////////////
 bool DCFile::
-write(const string &filename) const {
-  ofstream out(filename.c_str());
+write(Filename filename) const {
+  ofstream out;
+
+#ifdef WITHIN_PANDA
+  filename.set_text();
+  filename.open_write(out);
+#else
+  out.open(filename.c_str());
+#endif
 
   if (!out) {
     cerr << "Can't open " << filename << " for output.\n";

+ 2 - 2
direct/src/dcparser/dcFile.h

@@ -22,10 +22,10 @@ PUBLISHED:
   DCFile();
   ~DCFile();
 
-  bool read(const string &filename);
+  bool read(Filename filename);
   bool read(istream &in, const string &filename = string());
 
-  bool write(const string &filename) const;
+  bool write(Filename filename) const;
   bool write(ostream &out, const string &filename = string()) const;
 
   int get_num_classes();

+ 5 - 0
direct/src/dcparser/dcbase.h

@@ -19,6 +19,7 @@
 
 #include <directbase.h>
 #include <notify.h>
+#include <filename.h>
 
 #else
 
@@ -70,6 +71,10 @@ using namespace std;
 #define EXPCL_DIRECT
 #define EXPTP_DIRECT
 
+// Panda defines a special Filename class.  We'll use an ordinary
+// string instead.
+typedef string Filename;
+
 #endif  // WITHIN_PANDA
 
 #endif  // DCBASE_H

+ 3 - 2
direct/src/distributed/ClientRepository.py

@@ -28,9 +28,10 @@ class ClientRepository(DirectObject.DirectObject):
 
     def parseDcFile(self, dcFileName):
         self.dcFile = DCFile()
-        readResult = self.dcFile.read(dcFileName)
+        fname = Filename(dcFileName)
+        readResult = self.dcFile.read(fname)
         if not readResult:
-            self.notify.error("Could not read dcfile: " + str(dcFileName.cStr()))
+            self.notify.error("Could not read dcfile: " + dcFileName)
         return self.parseDcClasses(self.dcFile)
 
     def parseDcClasses(self, dcFile):