@@ -2798,7 +2798,7 @@ HRESULT DustMiteProject()
27982798 if (msgRet != IDYES )
27992799 return S_FALSE ;
28002800
2801- string workdir = cfg.GetProjectDir();
2801+ string workdir = normalizeDir( cfg.GetProjectDir() );
28022802
28032803 auto pane = getVisualDOutputPane();
28042804 scope (exit) release (pane);
@@ -2822,7 +2822,9 @@ HRESULT DustMiteProject()
28222822 }
28232823 pane.OutputString(_toUTF16z(" created clean copy of the project in " ~ dustmitepath ~ " \n " ));
28242824
2825- nworkdir = npath; // TODO
2825+ auto reldir = makeRelative(workdir, commonpath);
2826+ npath = makeDirnameCanonical(npath, null );
2827+ nworkdir = makeDirnameCanonical(reldir, npath);
28262828 string nintdir = makeFilenameAbsolute(cfg.GetIntermediateDir(), nworkdir);
28272829 string noutdir = makeFilenameAbsolute(cfg.GetOutDir(), nworkdir);
28282830 mkdirRecurse(nworkdir);
@@ -2833,7 +2835,7 @@ HRESULT DustMiteProject()
28332835 std.file.write (normalizeDir(noutdir) ~ " empty.txt" , " " );
28342836
28352837 if (nworkdir != npath)
2836- cmdline ~= " cd " ~ quoteFilename(makeRelative(nworkdir, npath));
2838+ cmdline ~= " cd " ~ quoteFilename(makeRelative(nworkdir, npath)) ~ " \n " ;
28372839 cmdline ~= cfg.getCommandLine(true , true , false );
28382840 cmdfile = npath ~ " build.dustmite.bat" ;
28392841 std.file.write (cmdfile, cmdline);
@@ -2844,7 +2846,7 @@ HRESULT DustMiteProject()
28442846 string intdir = makeFilenameAbsolute(cfg.GetIntermediateDir(), workdir);
28452847 mkdirRecurse(intdir);
28462848 dustfile = intdir ~ " \\ dustmite.cmd" ;
2847- string opts = " --strip-comments --split *.bat:lines " ;
2849+ string opts = Package.GetGlobalOptions().dustmiteOpts ;
28482850 cmd = Package.GetGlobalOptions().findDmdBinDir() ~ " dustmite " ~ opts ~ " " ~ quoteFilename(npath[0 .. $- 1 ]) ~ " \" " ~ dustcmd ~ " \" " ;
28492851 std.file.write (dustfile, cmd ~ " \n pause\n " );
28502852 std.process.spawnShell (quoteFilename(dustfile), null , std.process.Config.none , nworkdir);
@@ -2876,3 +2878,41 @@ class DustMiteThread : CBuilderThread
28762878
28772879 string mBuildDir;
28782880}
2881+
2882+ unittest
2883+ {
2884+ CHierNode.shared_static_this();
2885+ Package pkg = newCom! Package.addref();
2886+ scope (exit) pkg.release();
2887+ string tmpdir = normalizeDir(tempDir());
2888+ string projdir = tmpdir ~ " test/dustmite/project/" ;
2889+ string projfile = projdir ~ " project.vdproj" ;
2890+ string platform = " Win32" , config = " Debug" ;
2891+ auto cfg = newCom! VCConfig(projfile, " test" , platform, config);
2892+
2893+ Project prj = newCom! Project(Package.GetProjectFactory(), " test" , projfile, platform, config);
2894+
2895+ mkdirRecurse(projdir);
2896+ string dfile1 = projdir ~ " dfile1.d" ;
2897+ std.file.write (dfile1, " // dfile1\n " );
2898+ auto pFile1 = newCom! CFileNode(" dfile1.d" );
2899+ prj.GetRootNode().AddTail(pFile1);
2900+
2901+ mkdirRecurse(tmpdir ~ " test/dustmite/other" );
2902+ string dfile2 = tmpdir ~ " test/dustmite/other/dfile2.d" ;
2903+ std.file.write (dfile2, " // dfile2\n " );
2904+ auto pFile2 = newCom! CFileNode(" ../other/dfile2.d" );
2905+ prj.GetRootNode().AddTail(pFile2);
2906+
2907+ string commonpath = commonProjectFolder(prj);
2908+ string dustmitepath = buildPath(dirName(commonpath), baseName(commonpath) ~ " .dustmite" );
2909+ assert (dustmitepath == tmpdir ~ r " test\dustmite.dustmite" );
2910+ if (std.file.exists (dustmitepath))
2911+ rmdirRecurse(dustmitepath);
2912+
2913+ string npath = copyProjectFolder(prj, dustmitepath);
2914+ assert (npath == normalizeDir(dustmitepath));
2915+
2916+ assert (std.file.exists (dustmitepath ~ r " \project\dfile1.d" ));
2917+ assert (std.file.exists (dustmitepath ~ r " \other\dfile2.d" ));
2918+ }
0 commit comments