dub run should create workingDirectory if it doesn't already exist
As per the documentation, workingDirectory is the directory cd'd into prior to running the executable from dub run. This is particularly useful if your program populates its local directory with default configs and other files, so you can simply define a folder as the workingDirectory, put that folder in .gitignore and have an easy way to run debug builds without cluttering your project.
The problem is that this folder is not auto-created by dub, resulting in the following awkward situations:
-
Everyone who clones your repo has to manually create the folder, probably after an unsuccessful
dub runattempt. -
Use
preRunCommandsto run some D code as a script to create the folder (sincemkdirworks differently on Windows and Linux and will exit with 1 if the folder already exists unless you set incompatible flags). -
You use some kind of wrapping build system, eg: calling dub from Gradle and creating-if-needed the
workingDirectory. -
You create the folder and then a
.gitkeep, cluttering your project.
All of this would be obviated if dub could simply make the folder itself.