src/file.cpp

changeset 500
cad8cdc42a64
parent 498
791c831c8020
child 503
bebe09014dd6
equal deleted inserted replaced
499:ebd30d9eb667 500:cad8cdc42a64
617 } 617 }
618 } 618 }
619 619
620 // File is open, now save the model to it. Note that LDraw requires files to 620 // File is open, now save the model to it. Note that LDraw requires files to
621 // have DOS line endings, so we terminate the lines with \r\n. 621 // have DOS line endings, so we terminate the lines with \r\n.
622 for (LDObject * obj : objects()) 622 for (LDObject* obj : objects())
623 f.write (obj->raw() + "\r\n"); 623 f.write (obj->raw() + "\r\n");
624 624
625 // File is saved, now clean up. 625 // File is saved, now clean up.
626 f.close(); 626 f.close();
627 627
1013 } 1013 }
1014 1014
1015 // ============================================================================= 1015 // =============================================================================
1016 // ----------------------------------------------------------------------------- 1016 // -----------------------------------------------------------------------------
1017 str LDFile::getShortName() 1017 str LDFile::getShortName()
1018 { if (name().length() > 0) 1018 { if (!name().isEmpty())
1019 return basename (name()); 1019 return basename (name());
1020
1021 if (!defaultName().isEmpty())
1022 return defaultName();
1020 1023
1021 return tr ("<anonymous>"); 1024 return tr ("<anonymous>");
1022 } 1025 }
1023 1026
1024 // ============================================================================= 1027 // =============================================================================

mercurial