builds array of all mountpoints inclding available drive letters
| 1859 | |
| 1860 | // builds array of all mountpoints inclding available drive letters |
| 1861 | void CMountPropertyPage::GetMountPoints(CStringArray & mountPoints) |
| 1862 | { |
| 1863 | CString mountpoints = theApp.GetProfileString(L"MountPoint", L"MountPoints", NULL); |
| 1864 | |
| 1865 | int i; |
| 1866 | wstring mpstr; |
| 1867 | |
| 1868 | for (i = 'A'; i <= 'Z'; i++) { |
| 1869 | WCHAR buf[3]; |
| 1870 | buf[0] = (WCHAR)i; |
| 1871 | buf[1] = ':'; |
| 1872 | buf[2] = '\0'; |
| 1873 | // add drive letters, both available ones and mounted (by us) ones |
| 1874 | if (MountPointManager::getInstance().find(buf, mpstr) || IsDriveLetterAvailable((WCHAR)i)) { |
| 1875 | mountPoints.Add(buf); |
| 1876 | } |
| 1877 | } |
| 1878 | |
| 1879 | i = 0; |
| 1880 | unordered_map<wstring, bool> dirmap; |
| 1881 | CString lc; |
| 1882 | // add pre-configured directory mount points, remembering which ones we've added |
| 1883 | for (CString path = mountpoints.Tokenize(L"|", i); i >= 0; path = mountpoints.Tokenize(L"|", i)) { |
| 1884 | mountPoints.Add(path); |
| 1885 | lc = path; |
| 1886 | lc.MakeLower(); |
| 1887 | dirmap.emplace((LPCWSTR)lc, true); |
| 1888 | } |
| 1889 | vector<wstring> mmps; |
| 1890 | // get mounted mountpoints, filtering out non empty dir ones (filter out drive letter ones) |
| 1891 | auto filter = [](const wchar_t* mp) -> bool { return is_mountpoint_a_dir(mp); }; |
| 1892 | MountPointManager::getInstance().get_mount_points(mmps, filter); |
| 1893 | // sort the mounted mount points ignoring case |
| 1894 | sort(mmps.begin(), mmps.end(), compare_mps_ignore_case); |
| 1895 | // Go through the mounted mount points adding any empty dir ones tha were not already added. |
| 1896 | // These are the empty dir mount points that were not pre-cofigured that were |
| 1897 | // mounted via the command line. |
| 1898 | for (auto & mp : mmps) { |
| 1899 | lc = mp.c_str(); |
| 1900 | lc.MakeLower(); |
| 1901 | auto it = dirmap.find((LPCWSTR)lc); |
| 1902 | if (it == dirmap.end()) { |
| 1903 | mountPoints.Add(mp.c_str()); |
| 1904 | } |
| 1905 | } |
| 1906 | } |
| 1907 | |
| 1908 | void CMountPropertyPage::DeleteMountPoint(int item) |
| 1909 | { |
nothing calls this directly
no test coverage detected