diff --git a/source/app.d b/source/app.d index a2639ed..0019c96 100644 --- a/source/app.d +++ b/source/app.d @@ -212,10 +212,22 @@ auto result = rdmd_pid.wait(); enforce(result == 0, "Build command failed with exit code "~to!string(result)); + if( settings.copyFiles.length ){ + 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; + logDebug(" %s to %s", src.toNativeString(), dst.toNativeString()); + copyFile(src, dst, true); + } + } + if( cmd == "run" ){ auto prg_pid = spawnProcess(run_exe_file, args[1 .. $]); result = prg_pid.wait(); remove(run_exe_file); + foreach( f; settings.copyFiles ) + remove((Path(run_exe_file).parentPath ~ Path(f).head).toNativeString()); enforce(result == 0, "Program exited with code "~to!string(result)); } diff --git a/source/dub/dub.d b/source/dub/dub.d index 88d61a7..929e6ee 100644 --- a/source/dub/dub.d +++ b/source/dub/dub.d @@ -622,9 +622,10 @@ dst.addLFlags(processVars(project_path, settings.lflags)); dst.addLibs(processVars(project_path, settings.libs)); dst.addFiles(processVars(project_path, settings.files, true)); + dst.addCopyFiles(processVars(project_path, settings.copyFiles, true)); dst.addVersions(processVars(project_path, settings.versions)); - dst.addImportDirs(processVars(project_path, settings.importPath)); // TODO: prepend project_path to relative paths here - dst.addStringImportDirs(processVars(project_path, settings.stringImportPath)); // TODO: prepend project_path to relative paths here + dst.addImportDirs(processVars(project_path, settings.importPath, true)); + dst.addStringImportDirs(processVars(project_path, settings.stringImportPath, true)); } private string[] processVars(string project_path, string[] vars, bool are_paths = false) diff --git a/source/dub/package_.d b/source/dub/package_.d index 615a8e7..2576b54 100644 --- a/source/dub/package_.d +++ b/source/dub/package_.d @@ -30,6 +30,7 @@ string[] lflags; string[] libs; string[] files; + string[] copyFiles; string[] versions; string[] importPath; string[] stringImportPath; @@ -40,6 +41,7 @@ addLFlags(getPlatformField(root, "lflags", platform)); addLibs(getPlatformField(root, "libs", platform)); addFiles(getPlatformField(root, "files", platform)); + addCopyFiles(getPlatformField(root, "copyFiles", platform)); addVersions(getPlatformField(root, "versions", platform)); addImportDirs(getPlatformField(root, "importPath", platform)); addStringImportDirs(getPlatformField(root, "stringImportPath", platform)); @@ -49,6 +51,7 @@ void addLFlags(string[] value) { add(lflags, value); } void addLibs(string[] value) { add(libs, value); } void addFiles(string[] value) { add(files, value); } + void addCopyFiles(string[] value) { add(copyFiles, value); } void addVersions(string[] value) { add(versions, value); } void addImportDirs(string[] value) { add(importPath, value); } void addStringImportDirs(string[] value) { add(stringImportPath, value); }