[QBS] Target pathnames getting too long on Windows

Christian Kandeler christian.kandeler at digia.com
Thu Sep 25 15:38:05 CEST 2014

On 09/25/2014 03:16 PM, Thomas Epting wrote:
>  > > Now with the new target structure introduced in Qbs 1.3 one can easily
>  > > exceed this limit. In this version, the target structure is composed of
>  > > these these parts (at least for MSVC):
>  > >
>  > >
> D:\<targetpath>\<profile>-release\<productname>.<profile>\.obj\<srcpath>\<filename>.cpp.obj
> Let me follow up on this. First, please note that I like the new target
> structure very much. It's simple, clean and comprehensible. However it's
> a shame that Windows still has this 260 character limitation.
> Maybe the second occurence of <profile> can be avoided. It seems to be
> redundant to me, and leaving it out helps a bit with the 260 char
> problem.

Not really possible, because products can have a different profile than 
the overall project. But we could shorten the name. In qbs master, we 
currently append a hash to a "clean" product name. I suppose this name 
could be shortened to some fixed length without the danger of 
introducing clashes.

> Another idea would be to find a suitable way to shorten <srcpath>.

Yes. What a module really means when it says "put the output file at 
<build dir> + <relative path of input file" is "I don't want the output 
file path to clash with another one that has the same file name, but 
whose input file lives in a different directory". The question is how to 
achieve that without putting a burden on module implementors. Maybe  qbs 
core could provide a JavaScript function called e.g. 
uniqueOutputFilePath() that takes an input file path and an output file 
name (the latter must be under the module's control, because it might be 
a target artifact) and returns the complete output file path. The 
implementation could simply hash the input file path and supply the 
result as a directory component.


More information about the Qbs mailing list