Skip to content

Commit 3740107

Browse files
committed
fix: auto-create workingDirectory before running executable
Create the workingDirectory if it does not exist before spawning the target process. This prevents `dub run` from failing when the workingDirectory has not been created yet. Fixes #3082
1 parent 3be7c51 commit 3740107

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

source/dub/generators/build.d

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,8 @@ class BuildGenerator : ProjectGenerator {
692692
runcwd = NativePath(buildsettings.workingDirectory);
693693
if (!runcwd.absolute) runcwd = cwd ~ runcwd;
694694
}
695+
if(!existsDirectory(runcwd))
696+
ensureDirectory(runcwd);
695697
if (!exe_file_path.absolute) exe_file_path = cwd ~ exe_file_path;
696698
runPreRunCommands(m_project.rootPackage, m_project, settings, buildsettings);
697699
logInfo("Running", Color.green, "%s %s", exe_file_path.relativeTo(runcwd), run_args.join(" "));

0 commit comments

Comments
 (0)