L-I-V / MQL-Tools

42 stars 15 forks source link

Added support for Wine on Linux #33

Open r7a7d7o opened 1 year ago

r7a7d7o commented 1 year ago

Added support for Wine on Linux

L-I-V commented 1 year ago

Hi r7a7d7o, Thanks for the example compile command through wine. I will definitely apply this solution in future versions.

amir-hossein-zarei commented 11 months ago

@L-I-V please add this feature

djorgens2 commented 7 months ago

Please do, much appreciated. Very nice work but incomplete without a wine starter.

Also note: the compiler cmd should always contain the target compiler given the source code. Looking forward to the next update.

At this moment, I'm content to run the compiler from the terminal - may even set up a default build script.

My build.sh looks like this and cost me a week to figure out! ;-)

#!/bin/bash
env
WINEPREFIX=$HOME/.mt4
/usr/bin/wine "$WINEPREFIX/drive_c/Program Files (x86)/FXChoice MetaTrader 4/metaeditor.exe" **/mql4** "$1" "$2" "$3" "$4" "$5"
L-I-V commented 7 months ago

Hi djorgens2, can you provide detailed information about the script, specifically about the parameters you use to run it? I'm currently implementing the ability to work with wine in the extension, and your approach might be more practical.

djorgens2 commented 7 months ago

Sure Enough - I'll even help you implement/test. See attached - let me know if you have any questions. VSCode-MT4-MT5-Config.odp

L-I-V commented 7 months ago

Hi djorgens2, thank you for the detailed description. Unfortunately, this method did not work for me on either MacOs or Linux. It's possible that I am doing something wrong, or the issue lies with the installed versions of wine. I would like to know if you are able to compile files with spaces in the name? Because in the suggested method by r7a7d7o, files with spaces in the name do not compile. In general, I have found a solution to this problem, but I would like to know how to compile files with spaces in the name using wine, without resorting to external methods.

djorgens2 commented 7 months ago

I looked at your code and (whoa) - your javascript is outstanding. The script I wrote works well - but - has severe limitations. Not sure what 'voodoo' you used in WinOS to actually get MQL to compile - I've never been able to get the compiler to operate from any of the cmd.exe, ps1, or bash shells. Always executes with no visible results or exceptions, just a blank empty screen and no log anywhere ...

Linux OTOH works really well, for mq4/mq5 compiles - but I can't get it to work for mqh - for some reason, even with the /s flag - none of the system global constants are loaded and draw exceptions.

The best I've seen yet is your code on windows which integrates seamlessly.

That said, the spaces in the names/folders shouldn't be an issue - when passing/formulating the content of the string, just wrap the text with "" (double/double quotes) as in "The dog said ""woof woof""".

Wrapping "" around in the context of my script solves this, ex:

 $ ~/mqlCompile.sh Experts/Program.mq4
 $ ~/mqlCompile.sh "Experts/My Program.mq4"    #< this works with spaces in the name;

In order to pass the param to the terminal - is there a way to pass the quotes in js? If possible, this would be more likely platform independent.

image

Badzoneyv4n commented 4 months ago

I've done all steps and I'm still getting a blank output , I don't know where the problem is. Screenshot at 2024-02-10 18-35-44 Screenshot at 2024-02-10 18-37-11

hbsystems commented 1 week ago

Thank you very much for your changes. They work perfectly on Linux Mint 21.3 without additional scripts.

You just have to configure the paths in the settings:

    "mql_tools.Metaeditor.Metaeditor4Dir": "/home/youruser/.mt4/drive_c/MT4/YourPlatform/metaeditor.exe",
    "mql_tools.Metaeditor.Include4Dir": "/home/youruser/.mt4/drive_c/MT4/YourPlatform/MQL4"

And it works!

image

I hope this PR will be merged as soon as possible.