dub root folder as environment-variable in VisualD

Rainer Schuetze r.sagitario at gmx.de
Wed Jan 6 07:39:18 UTC 2021



On 05/01/2021 00:43, ShadoLight wrote:
> 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\..."

Indeed I misunderstood. These paths are generated by dub, so it's mostly
dub that has to be changed to use some environment variable.

> 
> 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.

LOCALAPPDATA is probably what you are looking for. Only if it is not
set, dub uses APPDATA.

> 
> 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.
> 

There is also the option to "Add import paths of project dependencies"
which might help to remove most of the paths from the setting. That
option didn't exist when "dub generate" was implemented, though.


More information about the Digitalmars-d-ide mailing list