| 300 | } |
| 301 | |
| 302 | ZepBuffer* ZepEditor::GetFileBuffer(const ZepPath& filePath, uint32_t fileFlags, bool create) |
| 303 | { |
| 304 | auto path = GetFileSystem().Exists(filePath) ? GetFileSystem().Canonical(filePath) : filePath; |
| 305 | if (!path.empty()) |
| 306 | { |
| 307 | for (auto& pBuffer : m_buffers) |
| 308 | { |
| 309 | if (!pBuffer->GetFilePath().empty()) |
| 310 | { |
| 311 | if (GetFileSystem().Equivalent(pBuffer->GetFilePath(), path)) |
| 312 | { |
| 313 | return pBuffer.get(); |
| 314 | } |
| 315 | } |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | if (!create) |
| 320 | { |
| 321 | return nullptr; |
| 322 | } |
| 323 | |
| 324 | // Create buffer, try to load even if not present, the buffer represents the save path (it just isn't saved yet) |
| 325 | auto pBuffer = CreateNewBuffer(filePath); |
| 326 | pBuffer->SetFileFlags(fileFlags); |
| 327 | |
| 328 | return pBuffer; |
| 329 | } |
| 330 | |
| 331 | ZepWindow* ZepEditor::AddTree() |
| 332 | { |
no test coverage detected