Multifile problem in 1.8

I switched to 1.8 because of the installer icon issue with 1.7.2, and ran into what I think is a bug with this new feature:

  • Multifiles (and p3d files) now make a distinction between binary and text files

When adding a subfile to a multifile using the following code:

  def saveDataToMultifile(self, mf, data, dataFileName):
    dataString = self.dataToString(data)
    file = open(dataFileName + ".txt", "w")
    file.write(dataString)
    file.close()

    mf.addSubfile(dataFileName + ".txt", Filename(dataFileName + ".txt"), 5)
    if(mf.needsRepack()):
      mf.repack()
    mf.flush()

    os.remove(dataFileName + ".txt")

I get an assertion error.

AssertionError: fname.is_binary_or_text() at line 489 of c:\buildslave\release_sdk_win32\build\panda3d\panda\src\express\multifile.cxx

Which line gives that error?

line 489, it says. If you mean in my program, it’s the addSubfile line.

From the API reference of addSubfile:

//               Filename::set_binary() or set_text() must have been
//               called previously to specify the nature of the source
//               file.  If set_text() was called, the text flag will
//               be set on the subfile.