summaryrefslogtreecommitdiffstats
path: root/converter/source/main.cpp
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-27 18:59:08 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-27 18:59:08 +0100
commit8a21fbf0cec3af9c9a7b957fdbffb19addb0b7df (patch)
tree5992e352179d2cdf4c7ebd9f40cbc5321a1de2de /converter/source/main.cpp
parentIncluding converter update with windows binary from forums. Shouldn't need to load a solution to compile a windows program really. (diff)
downloadcuberite-8a21fbf0cec3af9c9a7b957fdbffb19addb0b7df.tar
cuberite-8a21fbf0cec3af9c9a7b957fdbffb19addb0b7df.tar.gz
cuberite-8a21fbf0cec3af9c9a7b957fdbffb19addb0b7df.tar.bz2
cuberite-8a21fbf0cec3af9c9a7b957fdbffb19addb0b7df.tar.lz
cuberite-8a21fbf0cec3af9c9a7b957fdbffb19addb0b7df.tar.xz
cuberite-8a21fbf0cec3af9c9a7b957fdbffb19addb0b7df.tar.zst
cuberite-8a21fbf0cec3af9c9a7b957fdbffb19addb0b7df.zip
Diffstat (limited to '')
-rw-r--r--converter/source/main.cpp52
1 files changed, 34 insertions, 18 deletions
diff --git a/converter/source/main.cpp b/converter/source/main.cpp
index 67da82804..6239cbd43 100644
--- a/converter/source/main.cpp
+++ b/converter/source/main.cpp
@@ -1,3 +1,5 @@
+#include "MemoryLeak.h"
+
#include <iostream>
#include "cNBTData.h"
#include "cTimer.h"
@@ -9,32 +11,37 @@
#include <dirent.h>
#endif
-int main () {
+int main ()
+{
+
+#ifdef _DEBUG
+ _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
+#endif
cTimer Timer;
clock_t progBegin = clock(); //start main program timer
std::string dir;
DIR* dp;
struct dirent *entry;
- int found;
+ int found;
std::string entrys;
- std::string str2;
+ std::string str2;
std::string str3;
- std::string filexPos;
+ std::string filexPos;
std::string filezPos;
std::string pak_name;
//string* dir_array;
int dir_num_files = 0;
int ctr = 0;
-#ifdef _WIN32
- if(dp = opendir("region\\")){
-#else
- if(dp = opendir("region/")){
-#endif
- while(entry = readdir(dp)){
+
+ if(dp = opendir("./"))
+ {
+ while(entry = readdir(dp))
+ {
entrys = entry->d_name;
found = entrys.find(".mcr");
- if ( (found!=std::string::npos) ) {
+ if ( (found!=std::string::npos) )
+ {
str2 = entrys.substr (2,sizeof(entrys));
filexPos = str2.substr (0,(int)str2.find("."));
str3 = str2.substr ((int)str2.find(".")+1, sizeof(str2));
@@ -47,13 +54,22 @@ int main () {
DeNotch.Converter ( entrys, pak_name );
- clock_t end=clock();
- std::cout << "Time to convert chunk: " << double(Timer.diffclock(end,begin)) << " Seconds"<< std::endl;
- }
- }
- closedir(dp);
- }
+ clock_t end=clock();
+ std::cout << "Time to convert chunk: " << double(Timer.diffclock(end,begin)) << " Seconds"<< std::endl;
+ }
+ }
+ closedir(dp);
+ }
clock_t progEnd = clock(); //end main program timer
std::cout << "Time to complete converter: " << double(Timer.diffclock(progEnd,progBegin)) << " Seconds"<< std::endl;
- return 0;
+
+#ifdef _DEBUG
+ _CrtDumpMemoryLeaks();
+#endif
+
+#ifdef _WIN32
+ system("PAUSE");
+#endif
+
+ return 0;
};