diff --git a/source/dub/dub.d b/source/dub/dub.d index 38af379..e8e34b9 100644 --- a/source/dub/dub.d +++ b/source/dub/dub.d @@ -364,7 +364,7 @@ logInfo("Successfully created an empty project in '%s'.", path.toNativeString()); } - void runDdox() + void runDdox(bool run) { auto ddox_pack = m_packageManager.getBestPackage("ddox", ">=0.0.0"); if (!ddox_pack) ddox_pack = m_packageManager.getBestPackage("ddox", "~master"); @@ -404,6 +404,12 @@ version(Windows) commands ~= "xcopy /S /D "~dub_path~"public\\* docs\\"; else commands ~= "cp -r \""~dub_path~"public/*\" docs/"; runCommands(commands); + + if (run) { + auto url = Url("file", m_rootPath~"docs/index.html"); + logDiagnostic("Openening generated docs at %s", url.toString()); + browse(url.toString()); + } } private void updatePackageSearchPath() diff --git a/source/dub/generators/build.d b/source/dub/generators/build.d index 346b170..085d88c 100644 --- a/source/dub/generators/build.d +++ b/source/dub/generators/build.d @@ -75,11 +75,13 @@ foreach (ref p; buildsettings.stringImportPaths) p = makeRelative(p); Path exe_file_path; + bool is_temp_target = false; if( generate_binary ){ if( settings.run ){ import std.random; auto rnd = to!string(uniform(uint.min, uint.max)); buildsettings.targetPath = (tmp~"dub/"~rnd).toNativeString(); + is_temp_target = true; } exe_file_path = Path(buildsettings.targetPath) ~ getTargetFileName(buildsettings, settings.platform); } @@ -98,7 +100,7 @@ foreach (f; cleanup_files) if (existsFile(f)) remove(f.toNativeString()); - if (generate_binary && settings.run) + if (is_temp_target) rmdirRecurse(buildsettings.targetPath); } @@ -114,7 +116,7 @@ // invoke the compiler logInfo("Running %s...", settings.platform.compilerBinary); - if( settings.run ) cleanup_files ~= exe_file_path; + if (generate_binary && settings.run) cleanup_files ~= exe_file_path; settings.compiler.invoke(buildsettings, settings.platform); } else { // determine path for the temporary object file