zero-plusplus / vscode-autohotkey-debug

https://marketplace.visualstudio.com/items?itemName=zero-plusplus.vscode-autohotkey-debug
53 stars 4 forks source link

Add `runtimeDir` to the launch.json #52

Closed zero-plusplus closed 3 years ago

zero-plusplus commented 4 years ago

Is there a demand for being able to change the default directory of the runtime? It is currently pinned to C:\Program Files\AutoHotkey.

SAbboushi commented 4 years ago

What would runtimeDir offer that is different from runtime?

"launch": {
        "configurations": [
            {
                "name": "AHK V2 Debug",
                "request": "launch",
                "type": "autohotkey",  // identifies the debugger
                "runtime": "J:/StandaloneApps/AutoHotkeyV2/AutoHotkeyU64.exe",
    "launch": {
        "configurations": [
            {
                "name": "AHKv2[a118] Debug",
                "request": "launch",
                "type": "autohotkey",  // identifies the debugger
                "runtime": "J:/StandaloneApps/AutoHotkey_v2.0-a118-1e6cd8a1/AutoHotkeyU64.exe",
zero-plusplus commented 4 years ago

You can configure the current directory when you make runtime a relative path.

It is possible to set it as follows.

{
    "runtimeDir": "w:/tools/AutoHotkey",
    "runtime_v1": "AutoHotkey.exe"
    "runtime_v2": "v2/AutoHotkey.exe"

Traditionally, you would have to set it up as follows.

{
    "runtime_v1": "w:/tools/AutoHotkey/AutoHotkey.exe"
    "runtime_v2": "w:/tools/AutoHotkey/v2/AutoHotkey.exe"

It's not a big change, but it will make it somewhat easier to see.

SAbboushi commented 4 years ago

If I recall, I cannot do it that way because I use .ahk for both v1 and v2. Is that correct?

zero-plusplus commented 4 years ago

You can use it, but it won't be of much benefit.

In your example, you can change this as follows.

"launch": {
        "configurations": [
            {
                "name": "AHK V2 Debug",
                "request": "launch",
                "type": "autohotkey",  // identifies the debugger
                "runtimeDir": "J:/StandaloneApps/AutoHotkeyV2"
                "runtime": "AutoHotkeyU64.exe",
    "launch": {
        "configurations": [
            {
                "name": "AHKv2[a118] Debug",
                "request": "launch",
                "type": "autohotkey",  // identifies the debugger
                "runtimeDir": "J:/StandaloneApps/AutoHotkey_v2.0-a118-1e6cd8a1"
                "runtime": "AutoHotkeyU64.exe",
zero-plusplus commented 4 years ago

Perhaps runtimeCwd is more appropriate than runtimeDir

SAbboushi commented 4 years ago

I am curious - what is meaning of "Cwd"?

zero-plusplus commented 4 years ago

It's an abbreviation for Current Working Directory

The relative path is converted to a full path based on this directory.

If you look here, it seems to be an appropriate name since cwd is a common option supported by the debugger.

zero-plusplus commented 4 years ago

I don't know what "runtime's current working directory" means, if I think about it. Normally, There is one "current" working directory. This misleads people into thinking there's more than one it.

So if I' m going to implement it, runtimeDir seems to be a better choice.

zero-plusplus commented 4 years ago

If the #62 is implemented, it might be a little more useful, since it requires setting the runtime path to up to five file extensions - ahk, ah2, ahk2, ahkh, and ahkh2.

zero-plusplus commented 3 years ago

Since runtime will be deprecated in the future, this draft will be discarded.