mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-31 02:26:29 +03:00
Removed boost dependency ( now use PlusCallback for callbacks, and use my own lexical cast ). With this improved a lot the compiling time. As far as i could test, PlusCallback is faster than boos::function too.
I added a couple of checks to avoid rendering problems on fonts. And added some minor fixes.
This commit is contained in:
@@ -114,6 +114,97 @@ std::string AppPath() {
|
||||
#endif
|
||||
}
|
||||
|
||||
std::vector<std::wstring> FilesGetInPath( const std::wstring& path ) {
|
||||
std::vector<std::wstring> files;
|
||||
|
||||
#ifdef EE_COMPILER_MSVC
|
||||
#ifdef UNICODE
|
||||
std::wstring mPath( path );
|
||||
|
||||
if ( mPath[ mPath.size() - 1 ] == L'/' || mPath[ mPath.size() - 1 ] == L'\\' ) {
|
||||
mPath += L"*";
|
||||
} else {
|
||||
mPath += L"\\*";
|
||||
}
|
||||
|
||||
WIN32_FIND_DATA findFileData;
|
||||
HANDLE hFind = FindFirstFile( mPath.c_str(), &findFileData );
|
||||
|
||||
if( hFind != INVALID_HANDLE_VALUE ) {
|
||||
std::wstring tmpstr( findFileData.cFileName );
|
||||
|
||||
if ( tmpstr != L"." && tmpstr != L".." )
|
||||
files.push_back( tmpstr );
|
||||
|
||||
while( FindNextFile( hFind, &findFileData ) ) {
|
||||
tmpstr = std::wstring( findFileData.cFileName );
|
||||
|
||||
if ( tmpstr != L"." && tmpstr != L".." )
|
||||
files.push_back( findFileData.cFileName );
|
||||
}
|
||||
|
||||
FindClose( hFind );
|
||||
}
|
||||
#else
|
||||
std::wstring mPath( path );
|
||||
|
||||
if ( mPath[ mPath.size() - 1 ] == L'/' || mPath[ mPath.size() - 1 ] == L'\\' ) {
|
||||
mPath += L"*";
|
||||
} else {
|
||||
mPath += L"\\*";
|
||||
}
|
||||
|
||||
WIN32_FIND_DATA findFileData;
|
||||
HANDLE hFind = FindFirstFile( (LPCTSTR) mPath.c_str(), &findFileData );
|
||||
|
||||
if( hFind != INVALID_HANDLE_VALUE ) {
|
||||
std::wstring tmpstr( findFileData.cFileName );
|
||||
|
||||
if ( tmpstr != L"." && tmpstr != L".." )
|
||||
files.push_back( tmpstr );
|
||||
|
||||
while( FindNextFile( hFind, &findFileData ) ) {
|
||||
tmpstr = std::wstring( findFileData.cFileName );
|
||||
|
||||
if ( tmpstr != "." && tmpstr != ".." )
|
||||
files.push_back( std::wstring( findFileData.cFileName ) );
|
||||
}
|
||||
|
||||
FindClose( hFind );
|
||||
}
|
||||
#endif
|
||||
|
||||
return files;
|
||||
#else
|
||||
DIR *dp;
|
||||
struct dirent *dirp;
|
||||
|
||||
if( ( dp = opendir( wstringTostring( path.c_str() ).c_str() ) ) == NULL)
|
||||
return files;
|
||||
|
||||
while ( ( dirp = readdir(dp) ) != NULL) {
|
||||
if ( strcmp( dirp->d_name, ".." ) != 0 && strcmp( dirp->d_name, "." ) != 0 ) {
|
||||
|
||||
char * p = &dirp->d_name[0];
|
||||
std::wstring tmp;
|
||||
|
||||
while ( *p ) {
|
||||
unsigned char y = *p;
|
||||
tmp.push_back( y );
|
||||
p++;
|
||||
}
|
||||
|
||||
files.push_back( tmp );
|
||||
}
|
||||
}
|
||||
|
||||
closedir(dp);
|
||||
|
||||
return files;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> FilesGetInPath( const std::string& path ) {
|
||||
std::vector<std::string> files;
|
||||
|
||||
@@ -224,6 +315,10 @@ eeDouble GetSystemTime() {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool IsDirectory( const std::wstring& path ) {
|
||||
return IsDirectory( wstringTostring( path ) );
|
||||
}
|
||||
|
||||
bool IsDirectory( const std::string& path ) {
|
||||
#ifndef EE_COMPILER_MSVC
|
||||
DIR *dp;
|
||||
|
||||
Reference in New Issue
Block a user