dub root folder as environment-variable in VisualD

ShadoLight ettienne.gilbert at gmail.com
Mon Jan 4 23:43:05 UTC 2021


On Monday, 4 January 2021 at 20:40:37 UTC, Rainer Schuetze wrote:
>
>
> On 03/01/2021 23:40, ShadoLight wrote:
>> On Sunday, 3 January 2021 at 22:21:54 UTC, ShadoLight wrote: 
>> [..]
>>>
>>>
>>> Is there some way this can be done at the moment? (modulo 
>>> some trickery using external *.bat files or system 
>>> environment-variables)
>>>
>> 
>> At the moment I can make this work by creating a system/user 
>> environment-variable for this, but this still means I need to 
>> modify (typically multiple paths in the VisualD project each 
>> time I generate a VisualD project with dub.
>> 
>> (Well, you obviously also have to do this if you manually 
>> create a VisualD project inside VS that has dependencies - but 
>> then at least you expect to do this since you are doing 
>> everything manually).
>> 
>> I'm interested if there is currently a way to do this via 
>> dub..? or VisualD?
>
> AFAICT dub generates the VS solution in the same folder as your 
> root project. So maybe you can use $(SOLUTIONPATH) as a 
> replacement in the generated visuald project. See 
> https://rainers.github.io/visuald/visuald/ProjectConfig.html

Hi Rainer, thanks for the reply but, no, that is actually what I 
had in mind. It is not a "macro replacement" variable to the path 
to the generated visuald project, it is a "macro" variable (i.e. 
it would be something like $(DUBROOTPATH)) usable in VisualD's 
Project Properties for any paths to dub packages that the 
generated visuald project depends on ("Additional Import 
Paths"/"String Import Paths"/"Library Files"/etc)

My issue is really just the verbose-ness of paths to dub packages 
... they are all quite long and, since they all share the same 
path to the dub root of all packages i.e...

"C:\Users\userName\AppData\Local\dub\packages\some\path\to\dep1\..."
"C:\Users\userName\AppData\Local\dub\packages\some\path\to\dep2\..."

..it would just be nice to be able to be able to shorten this 
to...

"$(DUBROOTPATH)some\path\to\dep1\..."
"$(DUBROOTPATH)some\path\to\dep2\..."

It would also be a bit more flexible to switch the $() macro to 
point to a local (modified) version of a package, for example.

I thought I could instead use 
"$(APPDATA)dub\packages\some\path\to\dep1\..." as an acceptable 
alternative (I found some dub forum post that claimed that is 
what dub uses on windows), but it does not work - my APPDATA 
points to "..\AppData\Roaming\..", whilst dub used 
"..\AppData\Local\..." for packages in my case.

I know APPDATA can be defined differently (Roaming vs Local) 
according to whether your computer is part of a domain or 
something (mine is), but in my case dub did not seem to use the 
APPDATA variable as mine is defined, so I've had to add my own 
user variable to resolve this.

I figure it would have been nice to be able to use the same 
system environment variables dub uses to access the packages, as 
that will make it easier to update dub to use the system 
variables, rather than the full paths, when it generates the 
visuald project.

But this id really not very important.



More information about the Digitalmars-d-ide mailing list