- [FIX] En Windows ficava backslashes i tot petaba
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
#include <vector>
|
||||
#include <string.h>
|
||||
|
||||
using namespace std;
|
||||
namespace fs = std::filesystem;
|
||||
@@ -103,7 +104,11 @@ void doPack()
|
||||
fo.write( (char*)&file.size, 4 );
|
||||
const uint8_t path_size = file.path.size();
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user