Load one path per line from a CTextFile. Returns true if the file was opened (even if empty); false if it didn't exist or couldn't be opened. Every line is kept regardless of whether the path currently exists on disk. Previously the loader called DirExists() and dropped non-existing entries here, but ReloadSharedFolders' trailing SaveSharedFolders() then persisted the post-filter list back to all
| 1873 | // the in-memory list and on disk is harmless and lets the user |
| 1874 | // recover automatically once the path is accessible again. |
| 1875 | bool LoadDirListFile(const wxString & path, CPreferences::PathList & out) |
| 1876 | { |
| 1877 | out.clear(); |
| 1878 | CTextFile file; |
| 1879 | if (!file.Open(path, CTextFile::read)) { |
| 1880 | return false; |
| 1881 | } |
| 1882 | wxArrayString lines = file.ReadLines(txtReadDefault, wxConvUTF8); |
| 1883 | for (size_t i = 0; i < lines.size(); ++i) { |
| 1884 | out.push_back(CPath(lines[i])); |
| 1885 | } |
| 1886 | return true; |
| 1887 | } |
| 1888 | |
| 1889 | // Walk `root` recursively, appending `root` itself and every |
| 1890 | // descendant directory to `out`. Uses CDirIterator::Dir so hidden |