From 8f617d337968b54ea4808df70416cb1b06c1cf06 Mon Sep 17 00:00:00 2001 From: Juan Hernando Vieites Date: Wed, 26 Apr 2017 17:23:26 +0200 Subject: [PATCH] brain::Circuit accepts full paths to mvd files in CircuitPath --- brain/detail/circuit.h | 2 +- brion/blueConfig.cpp | 16 +++++++++------- doc/Changelog.md | 2 ++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/brain/detail/circuit.h b/brain/detail/circuit.h index bab1041..eeb204a 100644 --- a/brain/detail/circuit.h +++ b/brain/detail/circuit.h @@ -266,7 +266,7 @@ class Circuit::Impl "Afferent synaptic projection not found: " + name)); } fs::path path(source->second.getPath() + externalAfferentFilename); - if (fs::is_regular_file(path) || fs::is_symlink(path)) + if (fs::exists(path) && fs::is_regular_file(fs::canonical(path))) synapses.reset(new brion::Synapse(path.string())); else // Trying with the afferent synapses filename as a fallback diff --git a/brion/blueConfig.cpp b/brion/blueConfig.cpp index ace7241..65225a6 100644 --- a/brion/blueConfig.cpp +++ b/brion/blueConfig.cpp @@ -247,13 +247,15 @@ brion::Targets BlueConfig::getTargets() const URI BlueConfig::getCircuitSource() const { - const std::string& path = - get(CONFIGSECTION_RUN, _impl->getRun(), BLUECONFIG_CIRCUIT_PATH_KEY); - const std::string filename = - path + (fs::exists(fs::path(path) / CIRCUIT_FILE_MVD3) - ? CIRCUIT_FILE_MVD3 - : CIRCUIT_FILE_MVD2); - + const fs::path path( + get(CONFIGSECTION_RUN, _impl->getRun(), BLUECONFIG_CIRCUIT_PATH_KEY)); + std::string filename = path.string(); + if (fs::exists(path) && !fs::is_regular_file(fs::canonical(path))) + { + filename = fs::exists(path / CIRCUIT_FILE_MVD3) + ? (path / CIRCUIT_FILE_MVD3).string() + : (path / CIRCUIT_FILE_MVD2).string(); + } URI uri; uri.setScheme("file"); uri.setPath(filename); diff --git a/doc/Changelog.md b/doc/Changelog.md index 2a7176c..363f176 100644 --- a/doc/Changelog.md +++ b/doc/Changelog.md @@ -3,6 +3,8 @@ Changelog {#Changelog} # git master +* [151](https://github.com/BlueBrain/Brion/pull/151): + brain::Circuit accepts full paths to mvd files in CircuitPath * [150](https://github.com/BlueBrain/Brion/pull/150): - Added a new method in brain::Circuit to obtain synapses for afferent projections from outside the circuit (e.g. thalamocortical projections).