@@ -146,7 +146,7 @@ class PackageManager {
146
146
import std.algorithm.iteration : map;
147
147
import std.array : array;
148
148
149
- m_repositories.length = LocalPackageType .max+ 1 ;
149
+ m_repositories.length = PlacementLocation .max+ 1 ;
150
150
m_repositories ~= custom_cache_paths.map! (p => Repository(p)).array;
151
151
152
152
refresh(false );
@@ -319,7 +319,7 @@ class PackageManager {
319
319
320
320
string gitReference = versionSpec.chompPrefix(" ~" );
321
321
NativePath destination = getPackagePath(
322
- m_repositories[LocalPackageType .user].packagePath,
322
+ m_repositories[PlacementLocation .user].packagePath,
323
323
name, versionSpec);
324
324
// For libraries leaking their import path
325
325
destination ~= name;
@@ -475,28 +475,28 @@ class PackageManager {
475
475
476
476
/* * Returns a list of all package overrides for the given scope.
477
477
*/
478
- const (PackageOverride)[] getOverrides (LocalPackageType scope_)
478
+ const (PackageOverride)[] getOverrides (PlacementLocation scope_)
479
479
const {
480
480
return m_repositories[scope_].overrides;
481
481
}
482
482
483
483
/* * Adds a new override for the given package.
484
484
*/
485
- void addOverride (LocalPackageType scope_, string package_, Dependency version_spec, Version target)
485
+ void addOverride (PlacementLocation scope_, string package_, Dependency version_spec, Version target)
486
486
{
487
487
m_repositories[scope_].overrides ~= PackageOverride(package_, version_spec, target);
488
488
writeLocalPackageOverridesFile(scope_);
489
489
}
490
490
// / ditto
491
- void addOverride (LocalPackageType scope_, string package_, Dependency version_spec, NativePath target)
491
+ void addOverride (PlacementLocation scope_, string package_, Dependency version_spec, NativePath target)
492
492
{
493
493
m_repositories[scope_].overrides ~= PackageOverride(package_, version_spec, target);
494
494
writeLocalPackageOverridesFile(scope_);
495
495
}
496
496
497
497
/* * Removes an existing package override.
498
498
*/
499
- void removeOverride (LocalPackageType scope_, string package_, Dependency version_spec)
499
+ void removeOverride (PlacementLocation scope_, string package_, Dependency version_spec)
500
500
{
501
501
Repository* rep = &m_repositories[scope_];
502
502
foreach (i, ovr; rep.overrides) {
@@ -643,7 +643,7 @@ class PackageManager {
643
643
remove(pack);
644
644
}
645
645
646
- Package addLocalPackage (NativePath path, string verName, LocalPackageType type)
646
+ Package addLocalPackage (NativePath path, string verName, PlacementLocation type)
647
647
{
648
648
path.endsWithSlash = true ;
649
649
auto pack = Package.load(path);
@@ -669,7 +669,7 @@ class PackageManager {
669
669
return pack;
670
670
}
671
671
672
- void removeLocalPackage (NativePath path, LocalPackageType type)
672
+ void removeLocalPackage (NativePath path, PlacementLocation type)
673
673
{
674
674
path.endsWithSlash = true ;
675
675
@@ -693,14 +693,14 @@ class PackageManager {
693
693
}
694
694
695
695
// / For the given type add another path where packages will be looked up.
696
- void addSearchPath (NativePath path, LocalPackageType type)
696
+ void addSearchPath (NativePath path, PlacementLocation type)
697
697
{
698
698
m_repositories[type].searchPath ~= path;
699
699
writeLocalPackageList(type);
700
700
}
701
701
702
702
// / Removes a search path from the given type.
703
- void removeSearchPath (NativePath path, LocalPackageType type)
703
+ void removeSearchPath (NativePath path, PlacementLocation type)
704
704
{
705
705
m_repositories[type].searchPath = m_repositories[type].searchPath.filter! (p => p != path)().array();
706
706
writeLocalPackageList(type);
@@ -711,7 +711,7 @@ class PackageManager {
711
711
logDiagnostic(" Refreshing local packages (refresh existing: %s)..." , refresh_existing_packages);
712
712
713
713
// load locally defined packages
714
- void scanLocalPackages (LocalPackageType type)
714
+ void scanLocalPackages (PlacementLocation type)
715
715
{
716
716
NativePath list_path = m_repositories[type].packagePath;
717
717
Package[] packs;
@@ -770,9 +770,9 @@ class PackageManager {
770
770
}
771
771
if (! m_disableDefaultSearchPaths)
772
772
{
773
- scanLocalPackages(LocalPackageType .system);
774
- scanLocalPackages(LocalPackageType .user);
775
- scanLocalPackages(LocalPackageType.package_ );
773
+ scanLocalPackages(PlacementLocation .system);
774
+ scanLocalPackages(PlacementLocation .user);
775
+ scanLocalPackages(PlacementLocation.local );
776
776
}
777
777
778
778
auto old_packages = m_packages;
@@ -825,7 +825,7 @@ class PackageManager {
825
825
foreach (p; this .completeSearchPath)
826
826
scanPackageFolder(p);
827
827
828
- void loadOverrides (LocalPackageType type)
828
+ void loadOverrides (PlacementLocation type)
829
829
{
830
830
m_repositories[type].overrides = null ;
831
831
auto ovrfilepath = m_repositories[type].packagePath ~ LocalOverridesFilename;
@@ -842,9 +842,9 @@ class PackageManager {
842
842
}
843
843
if (! m_disableDefaultSearchPaths)
844
844
{
845
- loadOverrides(LocalPackageType.package_ );
846
- loadOverrides(LocalPackageType .user);
847
- loadOverrides(LocalPackageType .system);
845
+ loadOverrides(PlacementLocation.local );
846
+ loadOverrides(PlacementLocation .user);
847
+ loadOverrides(PlacementLocation .system);
848
848
}
849
849
}
850
850
@@ -878,7 +878,7 @@ class PackageManager {
878
878
return hash[].dup ;
879
879
}
880
880
881
- private void writeLocalPackageList (LocalPackageType type)
881
+ private void writeLocalPackageList (PlacementLocation type)
882
882
{
883
883
Json[] newlist;
884
884
foreach (p; m_repositories[type].searchPath) {
@@ -902,7 +902,7 @@ class PackageManager {
902
902
writeJsonFile(path ~ LocalPackagesFilename, Json(newlist));
903
903
}
904
904
905
- private void writeLocalPackageOverridesFile (LocalPackageType type)
905
+ private void writeLocalPackageOverridesFile (PlacementLocation type)
906
906
{
907
907
Json[] newlist;
908
908
foreach (ovr; m_repositories[type].overrides) {
@@ -975,10 +975,11 @@ struct PackageOverride {
975
975
}
976
976
}
977
977
978
- enum LocalPackageType {
979
- package_,
980
- user,
981
- system
978
+ deprecated (" Use `PlacementLocation` instead" )
979
+ enum LocalPackageType : PlacementLocation {
980
+ package_ = PlacementLocation.local,
981
+ user = PlacementLocation.user,
982
+ system = PlacementLocation.system,
982
983
}
983
984
984
985
private enum LocalPackagesFilename = " local-packages.json" ;
0 commit comments