| 216 | } |
| 217 | |
| 218 | void SampleBrowser::SetDirectory(String dirPath) |
| 219 | { |
| 220 | mCurrentDirectory = dirPath; |
| 221 | |
| 222 | mDirectoryListing.clear(); |
| 223 | |
| 224 | if (dirPath != "") |
| 225 | { |
| 226 | String matcher = TheSynth->GetAudioFormatManager().getWildcardForAllFormats(); |
| 227 | |
| 228 | StringArray wildcards; |
| 229 | wildcards.addTokens(matcher, ";,", "\"'"); |
| 230 | wildcards.trim(); |
| 231 | wildcards.removeEmptyStrings(); |
| 232 | |
| 233 | mDirectoryListing.add(".."); |
| 234 | |
| 235 | File dir(ofToSamplePath(dirPath.toStdString())); |
| 236 | for (auto file : dir.findChildFiles(File::findFilesAndDirectories | File::ignoreHiddenFiles, false)) |
| 237 | { |
| 238 | bool include = false; |
| 239 | if (file.isDirectory()) |
| 240 | { |
| 241 | include = true; |
| 242 | } |
| 243 | else |
| 244 | { |
| 245 | for (auto& w : wildcards) |
| 246 | { |
| 247 | if (file.getFileName().matchesWildcard(w, true)) |
| 248 | { |
| 249 | include = true; |
| 250 | break; |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | if (include) |
| 255 | mDirectoryListing.add(file.getFullPathName()); |
| 256 | } |
| 257 | } |
| 258 | else |
| 259 | { |
| 260 | Array<File> roots; |
| 261 | File::findFileSystemRoots(roots); |
| 262 | for (auto root : roots) |
| 263 | mDirectoryListing.add(root.getFullPathName()); |
| 264 | } |
| 265 | SortDirectoryListing(mDirectoryListing); |
| 266 | |
| 267 | ShowPage(0); |
| 268 | } |
| 269 | |
| 270 | void SampleBrowser::ShowPage(int page) |
| 271 | { |
nothing calls this directly
no test coverage detected