diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-25 16:24:51 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-25 16:24:51 +0200 |
commit | ba5b6ca75187e18942c463f7300b49061ebdc183 (patch) | |
tree | 99eb3efbb60791ed19d64bab32ee86444ee1fc46 /source/cFileFormatUpdater.cpp | |
parent | Fixed the Log altogether (doesn't use NULL-to-va_list assignment, compiles for RaspberryPi) (diff) | |
download | cuberite-ba5b6ca75187e18942c463f7300b49061ebdc183.tar cuberite-ba5b6ca75187e18942c463f7300b49061ebdc183.tar.gz cuberite-ba5b6ca75187e18942c463f7300b49061ebdc183.tar.bz2 cuberite-ba5b6ca75187e18942c463f7300b49061ebdc183.tar.lz cuberite-ba5b6ca75187e18942c463f7300b49061ebdc183.tar.xz cuberite-ba5b6ca75187e18942c463f7300b49061ebdc183.tar.zst cuberite-ba5b6ca75187e18942c463f7300b49061ebdc183.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cFileFormatUpdater.cpp | 58 |
1 files changed, 5 insertions, 53 deletions
diff --git a/source/cFileFormatUpdater.cpp b/source/cFileFormatUpdater.cpp index d17a35bb0..b58239eb2 100644 --- a/source/cFileFormatUpdater.cpp +++ b/source/cFileFormatUpdater.cpp @@ -12,13 +12,6 @@ -typedef std::list< std::string > StringList;
-StringList GetDirectoryContents( const char* a_Directory );
-
-
-
-
-
void cFileFormatUpdater::UpdateFileFormat()
{
UpdatePlayersOfWorld("world");
@@ -31,13 +24,13 @@ void cFileFormatUpdater::UpdateFileFormat() // Convert player .bin files to JSON
void cFileFormatUpdater::UpdatePlayersOfWorld( const char* a_WorldName )
{
- std::string PlayerDir = std::string( a_WorldName ) + "/player/";
+ AString PlayerDir = AString( a_WorldName ) + "/player/";
- StringList AllFiles = GetDirectoryContents( PlayerDir.c_str() );
- for( StringList::iterator itr = AllFiles.begin(); itr != AllFiles.end(); ++itr )
+ AStringList AllFiles = GetDirectoryContents( PlayerDir.c_str() );
+ for (AStringList::iterator itr = AllFiles.begin(); itr != AllFiles.end(); ++itr )
{
- std::string & FileName = *itr;
- if( FileName.rfind(".bin") != std::string::npos ) // Get only the files ending in .bin
+ AString & FileName = *itr;
+ if (FileName.rfind(".bin") != AString::npos) // Get only the files ending in .bin
{
PlayerBINtoJSON( (PlayerDir + FileName).c_str() );
}
@@ -148,44 +141,3 @@ void cFileFormatUpdater::PlayerBINtoJSON( const char* a_FileName ) -
-// Helper function
-StringList GetDirectoryContents( const char* a_Directory )
-{
- StringList AllFiles;
-#ifdef _WIN32
- std::string FileFilter = std::string( a_Directory ) + "*.*";
- HANDLE hFind;
- WIN32_FIND_DATA FindFileData;
-
- if( ( hFind = FindFirstFile(FileFilter.c_str(), &FindFileData) ) != INVALID_HANDLE_VALUE)
- {
- do
- {
- AllFiles.push_back( FindFileData.cFileName );
- } while( FindNextFile(hFind, &FindFileData) );
- FindClose(hFind);
- }
-#else
- DIR *dp;
- struct dirent *dirp;
- if( (dp = opendir( a_Directory ) ) == NULL)
- {
- LOGERROR("Error (%i) opening %s\n", errno, a_Directory );
- }
- else
- {
- while ((dirp = readdir(dp)) != NULL)
- {
- AllFiles.push_back( dirp->d_name );
- }
- closedir(dp);
- }
-#endif
-
- return AllFiles;
-}
-
-
-
-
|