| 26 | } |
| 27 | |
| 28 | FileEntryPtr FileRegister::createFile(std::wstring name, DirectoryEntry* parent, |
| 29 | DirectoryStats& stats) |
| 30 | { |
| 31 | const auto index = generateIndex(); |
| 32 | auto p = FileEntryPtr(new FileEntry(index, std::move(name), parent)); |
| 33 | |
| 34 | { |
| 35 | std::scoped_lock lock(m_Mutex); |
| 36 | |
| 37 | if (index >= m_Files.size()) { |
| 38 | m_Files.resize(index + 1); |
| 39 | } |
| 40 | |
| 41 | m_Files[index] = p; |
| 42 | } |
| 43 | |
| 44 | return p; |
| 45 | } |
| 46 | |
| 47 | FileIndex FileRegister::generateIndex() |
| 48 | { |