I have this situation where I want my editor to run dub to build the file I have currently opened (I'm using Scite as an example).

Typically, all I need is a SciTEDirectory.properties file in either the current or some parent directory with these contents:

command.go.subsystem.*.d=0
command.go.*.d=rdmd $(FilePath)

But if I want to use dub things won't be that easy. I can tell where exactly the dub.json file is located, so I could attempt to place my editor script next to it and write this in SciTEDirectory.properties:

command.go.subsystem.*.d=0
# SciteDirectoryHome => Directory path of SciTEDirectory.properties
command.go.*.d=dub $(SciteDirectoryHome)\dub.json --config=$(FileName)

That would have worked perfectly, but it doesn't because the working directory of the editor doesn't match the directory of the dub.json file. I can't make the editor change its current working directory.

Currently my best workaround is to write a separate batch file like so:

build.bat:

@echo off
setlocal EnableDelayedExpansion

:: CD into the root folder so dub can find dub.json
set this_path=%~dp0
cd %this_path%\..

:: Now run dub
dub %*

And my editor script then becomes:

command.go.subsystem.*.d=0
command.go.*.d=$(SciteDirectoryHome)\build.bat --config=$(FileName)

But I wish I could get rid of the batch file and just be able to run dub from within another directory.

Can this be implemented/supported?