Skip to content

Commit b7272b5

Browse files
committed
Added macros in order to cross-compile on Windows
1 parent 11ffd13 commit b7272b5

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/core/hexeditor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
HexEditor::HexEditor()
44
{
55
this->fileSize = 0;
6+
#ifdef WINDOWS
7+
string path = string(getenv("HOMEDRIVE")) + string(getenv("HOMEPATH")) + "\\fhex\\config.json";
8+
#else
69
string path = string(getenv("HOME")) + "/fhex/config.json";
10+
#endif
711
this->patternMatching = new PatternMatching(path);
812
}
913

src/fhex.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,11 @@ bool Fhex::loadFile(QString path) {
304304
this->clearFloatingLabels();
305305
this->statusBar.setText("Loading " + path);
306306
auto t1 = std::chrono::high_resolution_clock::now();
307+
#ifdef WINDOWS
308+
bool res = this->hexEditor->loadFile(path.toStdString());
309+
#else
307310
bool res = this->hexEditor->loadFileAsync(path.toStdString());
311+
#endif
308312
auto t2 = std::chrono::high_resolution_clock::now();
309313
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>( t2 - t1 ).count();
310314

@@ -384,7 +388,11 @@ void Fhex::compare(QString filename) {
384388
future<vector<pair<unsigned long, uint8_t>>> fut_res = async([this, filename]()
385389
{
386390
HexEditor newHexEditor;
391+
#ifdef WINDOWS
392+
newHexEditor.loadFile(filename.toStdString());
393+
#else
387394
newHexEditor.loadFileAsync(filename.toStdString());
395+
#endif
388396
while(!newHexEditor.isFileLoaded()) {
389397
std::this_thread::sleep_for(std::chrono::milliseconds(100));
390398
}

0 commit comments

Comments
 (0)