@@ -2579,7 +2579,7 @@ static String findBinaryInCustomPath(const char* const searchPath, const char* c | |||
searchFlags |= File::findDirectories; | |||
#endif | |||
Array<File> results; | |||
std::vector<File> results; | |||
for (const String *it=searchPaths.begin(), *end=searchPaths.end(); it != end; ++it) | |||
{ | |||
const File path(*it); | |||
@@ -2587,8 +2587,8 @@ static String findBinaryInCustomPath(const char* const searchPath, const char* c | |||
results.clear(); | |||
path.findChildFiles(results, searchFlags, true, filename); | |||
if (results.size() > 0) | |||
return results.getFirst().getFullPathName(); | |||
if (!results.empty()) | |||
return results.front().getFullPathName(); | |||
} | |||
// try changing extension | |||
@@ -2612,8 +2612,8 @@ static String findBinaryInCustomPath(const char* const searchPath, const char* c | |||
results.clear(); | |||
path.findChildFiles(results, searchFlags, true, filename); | |||
if (results.size() > 0) | |||
return results.getFirst().getFullPathName(); | |||
if (!results.empty()) | |||
return results.front().getFullPathName(); | |||
} | |||
return String(); | |||
@@ -25,7 +25,6 @@ | |||
#include "water/misc/Time.h" | |||
#include "water/text/StringArray.h" | |||
using water::jmax; | |||
using water::String; | |||
using water::StringArray; | |||
@@ -72,11 +72,11 @@ _CarlaCachedPluginInfo::_CarlaCachedPluginInfo() noexcept | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
static water::Array<water::File> gSFZs; | |||
static std::vector<water::File> gSFZs; | |||
static void findSFZs(const char* const sfzPaths) | |||
{ | |||
gSFZs.clearQuick(); | |||
gSFZs.clear(); | |||
CARLA_SAFE_ASSERT_RETURN(sfzPaths != nullptr,); | |||
@@ -87,10 +87,13 @@ static void findSFZs(const char* const sfzPaths) | |||
for (water::String *it = splitPaths.begin(), *end = splitPaths.end(); it != end; ++it) | |||
{ | |||
water::Array<water::File> results; | |||
std::vector<water::File> results; | |||
if (water::File(*it).findChildFiles(results, water::File::findFiles|water::File::ignoreHiddenFiles, true, "*.sfz") > 0) | |||
gSFZs.addArray(results); | |||
{ | |||
gSFZs.reserve(gSFZs.size() + results.size()); | |||
gSFZs.insert(gSFZs.end(), results.begin(), results.end()); | |||
} | |||
} | |||
} | |||
@@ -699,8 +702,8 @@ const CarlaCachedPluginInfo* carla_get_cached_plugin_info(CB::PluginType ptype, | |||
#endif | |||
case CB::PLUGIN_SFZ: { | |||
CARLA_SAFE_ASSERT_BREAK(index < static_cast<uint>(gSFZs.size())); | |||
return get_cached_plugin_sfz(gSFZs.getUnchecked(static_cast<int>(index))); | |||
CARLA_SAFE_ASSERT_BREAK(index < gSFZs.size()); | |||
return get_cached_plugin_sfz(gSFZs[index]); | |||
} | |||
default: | |||
@@ -63,12 +63,12 @@ struct NativePluginPresetManager { | |||
for (String *it = splitPaths.begin(), *end = splitPaths.end(); it != end; ++it) | |||
{ | |||
Array<File> results; | |||
std::vector<File> results; | |||
if (File(*it).findChildFiles(results, File::findFiles|File::ignoreHiddenFiles, true, wildcard) > 0) | |||
if (const int count = File(*it).findChildFiles(results, File::findFiles|File::ignoreHiddenFiles, true, wildcard)) | |||
{ | |||
for (File *it2 = results.begin(), *end2 = results.end(); it2 != end2; ++it2) | |||
filenames.add(it2->getFullPathName()); | |||
for (int i=0; i<count; ++i) | |||
filenames.add(results[i].getFullPathName()); | |||
} | |||
} | |||
@@ -263,11 +263,11 @@ bool File::deleteRecursively() const | |||
if (isDirectory()) | |||
{ | |||
Array<File> subFiles; | |||
std::vector<File> subFiles; | |||
findChildFiles (subFiles, File::findFilesAndDirectories, false); | |||
for (int i = subFiles.size(); --i >= 0;) | |||
worked = subFiles.getReference(i).deleteRecursively() && worked; | |||
worked = subFiles[i].deleteRecursively() && worked; | |||
} | |||
return deleteFile() && worked; | |||
@@ -315,12 +315,12 @@ bool File::copyDirectoryTo (const File& newDirectory) const | |||
{ | |||
if (isDirectory() && newDirectory.createDirectory()) | |||
{ | |||
Array<File> subFiles; | |||
std::vector<File> subFiles; | |||
findChildFiles (subFiles, File::findFiles, false); | |||
for (int i = 0; i < subFiles.size(); ++i) | |||
for (size_t i = 0; i < subFiles.size(); ++i) | |||
{ | |||
const File& src (subFiles.getReference(i)); | |||
const File& src (subFiles[i]); | |||
const File& dst (newDirectory.getChildFile (src.getFileName())); | |||
if (src.isSymbolicLink()) | |||
@@ -338,8 +338,8 @@ bool File::copyDirectoryTo (const File& newDirectory) const | |||
subFiles.clear(); | |||
findChildFiles (subFiles, File::findDirectories, false); | |||
for (int i = 0; i < subFiles.size(); ++i) | |||
if (! subFiles.getReference(i).copyDirectoryTo (newDirectory.getChildFile (subFiles.getReference(i).getFileName()))) | |||
for (size_t i = 0; i < subFiles.size(); ++i) | |||
if (! subFiles[i].copyDirectoryTo (newDirectory.getChildFile (subFiles[i].getFileName()))) | |||
return false; | |||
return true; | |||
@@ -556,7 +556,7 @@ void File::readLines (StringArray& destLines) const | |||
} | |||
//============================================================================== | |||
int File::findChildFiles (Array<File>& results, | |||
int File::findChildFiles (std::vector<File>& results, | |||
const int whatToLookFor, | |||
const bool searchRecursively, | |||
const String& wildCardPattern) const | |||
@@ -565,7 +565,7 @@ int File::findChildFiles (Array<File>& results, | |||
for (DirectoryIterator di (*this, searchRecursively, wildCardPattern, whatToLookFor); di.next();) | |||
{ | |||
results.add (di.getFile()); | |||
results.push_back (di.getFile()); | |||
++total; | |||
} | |||
@@ -30,6 +30,8 @@ | |||
#include "../misc/Result.h" | |||
#include "../text/String.h" | |||
#include <vector> | |||
namespace water { | |||
//============================================================================== | |||
@@ -492,7 +494,7 @@ public: | |||
@see getNumberOfChildFiles, DirectoryIterator | |||
*/ | |||
int findChildFiles (Array<File>& results, | |||
int findChildFiles (std::vector<File>& results, | |||
int whatToLookFor, | |||
bool searchRecursively, | |||
const String& wildCardPattern = "*") const; | |||
@@ -45,7 +45,7 @@ const char* find_dssi_ui(const char* const filename, const char* const label) no | |||
if (! checkLabel.endsWithChar('_')) checkLabel += "_"; | |||
if (! checkSName.endsWithChar('_')) checkSName += "_"; | |||
water::Array<water::File> results; | |||
std::vector<water::File> results; | |||
for (int i=water::File(pluginDir).findChildFiles(results, | |||
water::File::findFiles|water::File::ignoreHiddenFiles, false); --i >= 0;) | |||