@@ -812,6 +812,7 @@ void Project::load(const yaml &root)
812812
813813 auto read_single_dep = [this , &read_version](const auto &d, Package dependency = Package ())
814814 {
815+ bool local_ok = false ;
815816 if (d.IsScalar ())
816817 {
817818 auto p = extractFromStringAny (d.template as <String>());
@@ -834,39 +835,13 @@ void Project::load(const yaml &root)
834835 }
835836 if (d[" local" ].IsDefined () && allow_local_dependencies)
836837 {
837- // WARNING!
838- // probably this could be dangerous, maybe remove?
839- // if set local dep for a secure file on the system
840- // it will be read (or not?); how this affects system?
841- // will not lead to exec shell code somehow or whatever?
842- // ???
843- auto lp = d[" local" ].template as <String>();
844- auto ld = this ->load_local_dependency (lp);
845- if (!ld)
846- {
847- if (!dependency.ppath .empty () && !dependency.ppath .is_loc ())
848- {
849- try
850- {
851- Packages p;
852- p[dependency.ppath .toString ()] = dependency;
853- resolve_dependencies (p);
854- }
855- catch (const std::exception &)
856- {
857- // if not resolved, fail finally
858- throw ;
859- }
860- }
861-
862- if (dependency.ppath .empty ())
863- throw std::runtime_error (" Could not load local project: " + lp);
864- }
865-
866- if (dependency.ppath .is_relative () && rd.has_local_package (ld.value () / dependency.ppath ))
867- dependency.ppath = ld.value () / dependency.ppath ;
868- else // is this really needed?
869- dependency.ppath = ld.value ();
838+ auto p = d[" local" ].template as <String>();
839+ Package pkg;
840+ pkg.ppath = p;
841+ if (rd.known_local_packages .find (pkg) != rd.known_local_packages .end ())
842+ local_ok = true ;
843+ if (local_ok)
844+ dependency.ppath = p;
870845 }
871846 }
872847
@@ -886,7 +861,11 @@ void Project::load(const yaml &root)
886861 {
887862 // read other map fields
888863 if (d[" version" ].IsDefined ())
864+ {
889865 read_version (dependency, d[" version" ].template as <String>());
866+ if (local_ok)
867+ dependency.version = Version (LOCAL_VERSION_NAME);
868+ }
890869 if (d[" ref" ].IsDefined ())
891870 dependency.reference = d[" ref" ].template as <String>();
892871 if (d[" reference" ].IsDefined ())
0 commit comments