| 395 | } |
| 396 | |
| 397 | void PropertyFileIncluded::Restore(Base::XMLReader& reader) |
| 398 | { |
| 399 | reader.readElement("FileIncluded"); |
| 400 | if (reader.hasAttribute("file")) { |
| 401 | string file(reader.getAttribute<const char*>("file")); |
| 402 | if (!file.empty()) { |
| 403 | // initiate a file read |
| 404 | reader.addFile(file.c_str(), this); |
| 405 | // is in the document transient path |
| 406 | aboutToSetValue(); |
| 407 | _cValue = getDocTransientPath() + "/" + file; |
| 408 | _BaseFileName = file; |
| 409 | hasSetValue(); |
| 410 | } |
| 411 | } |
| 412 | // section is XML stream |
| 413 | else if (reader.hasAttribute("data")) { |
| 414 | string file(reader.getAttribute<const char*>("data")); |
| 415 | if (!file.empty()) { |
| 416 | // is in the document transient path |
| 417 | aboutToSetValue(); |
| 418 | _cValue = getDocTransientPath() + "/" + file; |
| 419 | reader.readBinFile(_cValue.c_str()); |
| 420 | reader.readEndElement("FileIncluded"); |
| 421 | _BaseFileName = file; |
| 422 | // set read-only after restoring the file |
| 423 | Base::FileInfo fi(_cValue.c_str()); |
| 424 | fi.setPermissions(Base::FileInfo::ReadOnly); |
| 425 | hasSetValue(); |
| 426 | } |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | void PropertyFileIncluded::SaveDocFile(Base::Writer& writer) const |
| 431 | { |
nothing calls this directly
no test coverage detected