diff --git a/source/app.d b/source/app.d index 0019c96..0e013ff 100644 --- a/source/app.d +++ b/source/app.d @@ -150,7 +150,7 @@ string[] flags = ["--force", "--build-only"]; string run_exe_file; if( cmd == "build" ){ - flags ~= "-of"~outfile; + flags ~= "-of"~(dub.binaryPath~outfile).toNativeString(); } else { version(Windows){ import std.random; @@ -216,7 +216,7 @@ logInfo("Copying files..."); foreach( f; settings.copyFiles ){ auto src = Path(f); - auto dst = (run_exe_file ? Path(run_exe_file).parentPath : Path("./")) ~ Path(f).head; + auto dst = (run_exe_file ? Path(run_exe_file).parentPath : dub.binaryPath) ~ Path(f).head; logDebug(" %s to %s", src.toNativeString(), dst.toNativeString()); copyFile(src, dst, true); } diff --git a/source/dub/dub.d b/source/dub/dub.d index 929e6ee..d92dd6c 100644 --- a/source/dub/dub.d +++ b/source/dub/dub.d @@ -91,6 +91,8 @@ reinit(); } + @property Path binaryPath() const { auto p = m_main.binaryPath; return p.length ? Path(p) : Path("./"); } + /// Gathers information string info() const { if(!m_main) @@ -489,6 +491,8 @@ @property inout(PackageManager) packageManager() inout { return m_packageManager; } + @property Path binaryPath() const { return m_app.binaryPath; } + void loadPackagefromCwd() { m_root = m_cwd; diff --git a/source/dub/package_.d b/source/dub/package_.d index 2576b54..0620c41 100644 --- a/source/dub/package_.d +++ b/source/dub/package_.d @@ -155,6 +155,7 @@ @property const(Url) url() const { return Url.parse(cast(string)m_meta["url"]); } @property const(Dependency[string]) dependencies() const { return m_dependencies; } @property const(LocalPacageDef)[] localPackageDefs() const { return m_localPackageDefs; } + @property string binaryPath() const { return m_meta.binaryPath.opt!string; } @property string[] configurations() const {