MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / BuildOldFilesForDirectory

Function BuildOldFilesForDirectory

manage/manage.cpp:1917–1953  ·  view source on GitHub ↗

Builds a list of old files in a path

Source from the content-addressed store, hash-verified

1915#if defined(WIN32)
1916// Builds a list of old files in a path
1917void BuildOldFilesForDirectory(const std::filesystem::path& path, FILETIME threshold) {
1918 HANDLE filehandle;
1919 WIN32_FIND_DATA filedata;
1920 std::filesystem::path newpath = path / "*.*";
1921 filehandle = FindFirstFile(newpath.u8string().c_str(), &filedata);
1922 bool go_ahead = true;
1923 if (filehandle == INVALID_HANDLE_VALUE)
1924 go_ahead = false;
1925 while (go_ahead) {
1926 bool add_it = false;
1927
1928 // if this file is newer than the last time we updated, add it to the list
1929
1930 if (filedata.ftLastWriteTime.dwHighDateTime > threshold.dwHighDateTime)
1931 add_it = true;
1932 if (filedata.ftLastWriteTime.dwHighDateTime == threshold.dwHighDateTime) {
1933 if (filedata.ftLastWriteTime.dwLowDateTime > threshold.dwLowDateTime)
1934 add_it = true;
1935 }
1936 if (filedata.ftCreationTime.dwHighDateTime > threshold.dwHighDateTime)
1937 add_it = true;
1938 if (filedata.ftCreationTime.dwHighDateTime == threshold.dwHighDateTime) {
1939 if (filedata.ftCreationTime.dwLowDateTime > threshold.dwLowDateTime)
1940 add_it = true;
1941 }
1942 // Add it to the list!
1943 if (add_it) {
1944 int primtype = GetPrimType(filedata.cFileName);
1945 OldFiles[Num_old_files].type = primtype;
1946 strcpy(OldFiles[Num_old_files].name, filedata.cFileName);
1947 Num_old_files++;
1948 }
1949 go_ahead = (FindNextFile(filehandle, &filedata) != 0);
1950 }
1951 if (filehandle != INVALID_HANDLE_VALUE)
1952 FindClose(filehandle);
1953}
1954
1955// Builds a list of old files so we know which ones to update
1956// Searches through all our netdirectories for old files

Callers 1

BuildOldFileListFunction · 0.85

Calls 1

GetPrimTypeFunction · 0.85

Tested by

no test coverage detected