diff --git a/source/dub/generators/build.d b/source/dub/generators/build.d index c23ea9d..e7c19f4 100644 --- a/source/dub/generators/build.d +++ b/source/dub/generators/build.d @@ -401,8 +401,12 @@ static string pathToObjName(string path) { - import std.path : buildNormalizedPath, dirSeparator, stripDrive; - return stripDrive(buildNormalizedPath(getcwd(), path~objSuffix))[1..$].replace(dirSeparator, "."); + import std.digest.crc; + import std.path : buildNormalizedPath, dirSeparator, relativePath, stripDrive; + if (path.endsWith(".d")) path = path[0 .. $-2]; + auto ret = buildNormalizedPath(getcwd(), path).replace(dirSeparator, "."); + auto idx = ret.lastIndexOf('.'); + return idx < 0 ? ret ~ objSuffix : format("%s_%(%02x%)%s", ret[idx+1 .. $], crc32Of(ret[0 .. idx]), objSuffix); } /// Compile a single source file (srcFile), and write the object to objName.