- [FIX] En Windows ficava backslashes i tot petaba

This commit is contained in:
2023-10-23 16:00:24 +02:00
parent 8f1cd9beef
commit a83daf8700

View File

@@ -3,6 +3,7 @@
#include <fstream> #include <fstream>
#include <filesystem> #include <filesystem>
#include <vector> #include <vector>
#include <string.h>
using namespace std; using namespace std;
namespace fs = std::filesystem; namespace fs = std::filesystem;
@@ -103,7 +104,11 @@ void doPack()
fo.write( (char*)&file.size, 4 ); fo.write( (char*)&file.size, 4 );
const uint8_t path_size = file.path.size(); const uint8_t path_size = file.path.size();
fo.write( (char*)&path_size, 1 ); fo.write( (char*)&path_size, 1 );
fo.write( file.path.c_str(), path_size ); // We use this preliminar step to replace '\' with '/', as respak2 in windows generates backslashes, which break everything
char replace[256];
strcpy(replace, file.path.c_str());
for (int i=0; i<path_size; ++i) if (replace[i] == '\\') replace[i] = '/';
fo.write( replace, path_size );
} }
fo.seekp(4); fo.seekp(4);