File tree 2 files changed +22
-6
lines changed
2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -758,8 +758,7 @@ class Command {
758
758
Dub dub;
759
759
760
760
if (options.bare) {
761
- dub = new Dub(NativePath(getcwd()));
762
- dub.rootPath = NativePath(options.root_path);
761
+ dub = new Dub(NativePath(options.root_path), NativePath(getcwd()));
763
762
dub.defaultPlacementLocation = options.placementLocation;
764
763
765
764
return dub;
@@ -2379,7 +2378,7 @@ class DustmiteCommand : PackageBuildCommand {
2379
2378
{
2380
2379
if (! m_testPackage.length)
2381
2380
return super .prepareDub(options);
2382
- return new Dub(NativePath(getcwd()));
2381
+ return new Dub(NativePath(options.root_path), NativePath( getcwd()));
2383
2382
}
2384
2383
2385
2384
override int execute (Dub dub, string [] free_args, string [] app_args)
Original file line number Diff line number Diff line change @@ -183,12 +183,27 @@ class Dub {
183
183
loading a package.
184
184
185
185
This constructor corresponds to the "--bare" option of the command line
186
- interface. Use
186
+ interface.
187
+
188
+ Params:
189
+ root = The root path of the Dub instance itself.
190
+ pkg_root = The root of the location where packages are located
191
+ Only packages under this location will be accessible.
192
+ Note that packages at the top levels will be ignored.
187
193
*/
188
- this (NativePath override_path )
194
+ this (NativePath root, NativePath pkg_root )
189
195
{
196
+ // Note: We're doing `init()` before setting the `rootPath`,
197
+ // to prevent `init` from reading the project's settings.
190
198
init();
191
- m_packageManager = new PackageManager(override_path);
199
+ this .m_rootPath = root;
200
+ m_packageManager = new PackageManager(pkg_root);
201
+ }
202
+
203
+ deprecated (" Use the overload that takes `(NativePath pkg_root, NativePath root)`" )
204
+ this (NativePath pkg_root)
205
+ {
206
+ this (pkg_root, pkg_root);
192
207
}
193
208
194
209
private void init ()
@@ -361,6 +376,8 @@ class Dub {
361
376
*/
362
377
@property NativePath rootPath() const { return m_rootPath; }
363
378
// / ditto
379
+ deprecated (" Changing the root path is deprecated as it has non-obvious pitfalls " ~
380
+ " (e.g. settings aren't reloaded). Instantiate a new `Dub` instead" )
364
381
@property void rootPath(NativePath root_path)
365
382
{
366
383
m_rootPath = root_path;
You can’t perform that action at this time.
0 commit comments