536 } |
536 } |
537 |
537 |
538 // Write all entries now |
538 // Write all entries now |
539 for (LDObject* obj : objs ()) { |
539 for (LDObject* obj : objs ()) { |
540 // LDraw requires files to have DOS line endings |
540 // LDraw requires files to have DOS line endings |
541 str line = fmt ("%s\r\n", obj->getContents ().chars ()); |
541 str line = fmt ("%s\r\n", obj->raw ().chars ()); |
542 fwrite (line.chars(), 1, line.len (), fp); |
542 fwrite (line.chars(), 1, line.len (), fp); |
543 } |
543 } |
544 |
544 |
545 fclose (fp); |
545 fclose (fp); |
546 |
546 |
799 |
799 |
800 if (fileInfo) |
800 if (fileInfo) |
801 ref->setFileInfo (fileInfo); |
801 ref->setFileInfo (fileInfo); |
802 else { |
802 else { |
803 // Couldn't load the file, mark it an error |
803 // Couldn't load the file, mark it an error |
804 ref->replace (new LDGibberish (ref->getContents (), "Could not open referred file")); |
804 ref->replace (new LDGibberish (ref->raw (), "Could not open referred file")); |
805 } |
805 } |
806 } |
806 } |
807 |
807 |
808 // Reparse gibberish files. It could be that they are invalid because |
808 // Reparse gibberish files. It could be that they are invalid because |
809 // of loading errors. Circumstances may be different now. |
809 // of loading errors. Circumstances may be different now. |