MCPcopy Create free account
hub / github.com/amule-project/amule / LoadDirListFile

Function LoadDirListFile

src/Preferences.cpp:1875–1887  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1873// the in-memory list and on disk is harmless and lets the user
1874// recover automatically once the path is accessible again.
1875bool 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

Callers 1

ReloadSharedFoldersMethod · 0.85

Calls 5

ReadLinesMethod · 0.80
CPathClass · 0.70
clearMethod · 0.45
OpenMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected