diff --git a/src/Bootil/Platform/Platform_LINUX.cpp b/src/Bootil/Platform/Platform_LINUX.cpp index a8e686c..f3277da 100644 --- a/src/Bootil/Platform/Platform_LINUX.cpp +++ b/src/Bootil/Platform/Platform_LINUX.cpp @@ -156,10 +156,11 @@ namespace Bootil BOOTIL_EXPORT int FindFiles( String::List* files, String::List* folders, const BString & strFind, bool bUpUpFolders ) { - BString dirName = strdup( strFind.c_str() ); - dirName = dirname( ( char* )dirName.c_str() ); - BString findName = strdup( strFind.c_str() ); - findName = basename( ( char* )findName.c_str() ); + std::vector tmp( strFind.c_str(), strFind.c_str() + strFind.size() + 1 ); + BString dirName( dirname( &tmp[0] ) ); + tmp = std::vector( strFind.c_str(), strFind.c_str() + strFind.size() + 1 ); + BString findName( basename( &tmp[0] ) ); + DIR* dp; dirent* dirp; int iFiles = 0; diff --git a/src/Bootil/Platform/Platform_OSX.cpp b/src/Bootil/Platform/Platform_OSX.cpp index 7fff84a..4043460 100644 --- a/src/Bootil/Platform/Platform_OSX.cpp +++ b/src/Bootil/Platform/Platform_OSX.cpp @@ -126,10 +126,11 @@ namespace Bootil BOOTIL_EXPORT int FindFiles( String::List* files, String::List* folders, const BString & strFind, bool bUpUpFolders ) { - BString dirName = strdup( strFind.c_str() ); - dirName = dirname( ( char* )dirName.c_str() ); - BString findName = strdup( strFind.c_str() ); - findName = basename( ( char* )findName.c_str() ); + std::vector tmp( strFind.c_str(), strFind.c_str() + strFind.size() + 1 ); + BString dirName( dirname( &tmp[0] ) ); + tmp = std::vector( strFind.c_str(), strFind.c_str() + strFind.size() + 1 ); + BString findName( basename( &tmp[0] ) ); + DIR* dp; dirent* dirp; int iFiles = 0;