| 52 | } |
| 53 | |
| 54 | void PDFFile::writeToConfig(const filesystem::path &filepath) { |
| 55 | if (filepath.empty()) // No destination file to save to |
| 56 | return; |
| 57 | |
| 58 | std::error_code ec; |
| 59 | auto confparse = Confparse{}; |
| 60 | confparse.Load(filepath); |
| 61 | |
| 62 | auto configDir = filesystem::weakly_canonical(filepath).parent_path(); |
| 63 | |
| 64 | if (!path.empty()) { |
| 65 | auto pdfFilePath = filesystem::relative(path, configDir, ec); |
| 66 | if (ec) { |
| 67 | SDL_LogError(SDL_LOG_CATEGORY_ERROR, "Error writing PDF file path: %d - %s", ec.value(), ec.message().c_str()); |
| 68 | } else { |
| 69 | confparse.WriteStr("PDFFilePath", pdfFilePath.string().c_str()); |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | filesystem::path PDFFile::getPath() const { |
| 75 | return this->path; |