MCPcopy Create free account
hub / github.com/Predelnik/DSpellCheck / are_paths_equal

Function are_paths_equal

src/spellers/HunspellInterface.cpp:172–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170void HunspellInterface::set_use_one_dic(bool value) { m_use_one_dic = value; }
171
172bool are_paths_equal(const wchar_t *path1, const wchar_t *path2) {
173 BY_HANDLE_FILE_INFORMATION bhfi1, bhfi2;
174 HANDLE h2;
175 DWORD access = 0;
176 DWORD share = FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE;
177
178 HANDLE h1 = CreateFile(path1, access, share, nullptr, OPEN_EXISTING,
179 (GetFileAttributes(path1) & FILE_ATTRIBUTE_DIRECTORY) != 0 ? FILE_FLAG_BACKUP_SEMANTICS : 0, nullptr);
180 if (INVALID_HANDLE_VALUE != h1) {
181 if (GetFileInformationByHandle(h1, &bhfi1) == FALSE)
182 bhfi1.dwVolumeSerialNumber = 0;
183 h2 = CreateFile(path2, access, share, nullptr, OPEN_EXISTING, (GetFileAttributes(path2) & FILE_ATTRIBUTE_DIRECTORY) != 0 ? FILE_FLAG_BACKUP_SEMANTICS : 0,
184 nullptr);
185 if (GetFileInformationByHandle(h2, &bhfi2) == FALSE)
186 bhfi2.dwVolumeSerialNumber = bhfi1.dwVolumeSerialNumber + 1;
187 } else
188 return false;
189
190 CloseHandle(h1);
191 CloseHandle(h2);
192 return INVALID_HANDLE_VALUE != h1 && INVALID_HANDLE_VALUE != h2 && bhfi1.dwVolumeSerialNumber == bhfi2.dwVolumeSerialNumber &&
193 bhfi1.nFileIndexHigh == bhfi2.nFileIndexHigh && bhfi1.nFileIndexLow == bhfi2.nFileIndexLow;
194}
195
196std::vector<LanguageInfo> HunspellInterface::get_language_list() const {
197 std::vector<LanguageInfo> list;

Callers 1

~HunspellInterfaceMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected