Boost filesystem Ver 2/3 transition
This is kind of a workaround to avoid having to maintain two variants. Explanation: between Boost 1.42 and 1.52 there was the transition to a reworked version of the filesystem library, itroducing some breaking changes The new version distinguishes much clearer between the native and the generic representation of paths -- which becomes relevant when porting to non-POXIX operating systems. Actually the intention was to use the generic path representation in all configuration; currently this distinction is moot, since we're caring only for POSIX systems. So the workaround is to use the fsys::path::string() function, which is available in both versions, but changed meaning to yield the native string. Later, when able to deprecate older Boost versions, we should switch to generic_string() Note: an alternative solution was found by Mike Fisher in 3b39f35 using the compiletime define BOOST_FILESYSTEM_VERSION=2 See also ticket #896
This commit is contained in:
parent
4ede0453be
commit
1c5ceaef15
3 changed files with 8 additions and 9 deletions
|
|
@ -53,9 +53,8 @@ namespace lumiera {
|
|||
string
|
||||
resolve (fsys::path iniSpec)
|
||||
{
|
||||
string file = iniSpec.leaf();
|
||||
string searchpath = iniSpec.branch_path().string();
|
||||
return resolveModulePath (file, searchpath);
|
||||
string searchpath = iniSpec.parent_path().string(); ///////////TICKET #896
|
||||
return resolveModulePath (iniSpec.filename(), searchpath);
|
||||
}
|
||||
|
||||
}//(End) implementation details
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace lib {
|
|||
{
|
||||
static const regex PICK_ORIGIN_TOKEN ("\\$?ORIGIN/?");
|
||||
static const string expandedOriginDir
|
||||
= fsys::path (findExePath()).remove_leaf().directory_string();
|
||||
= fsys::path (findExePath()).parent_path().string() + "/"; ///////////TICKET #896
|
||||
|
||||
return boost::regex_replace(src, PICK_ORIGIN_TOKEN, expandedOriginDir);
|
||||
}
|
||||
|
|
@ -81,24 +81,24 @@ namespace lib {
|
|||
|
||||
|
||||
string
|
||||
resolveModulePath (string moduleName, string searchPath)
|
||||
resolveModulePath (fsys::path moduleName, string searchPath)
|
||||
{
|
||||
fsys::path modulePathName (moduleName);
|
||||
SearchPathSplitter searchLocation(searchPath);
|
||||
SearchPathSplitter searchLocation(searchPath); ///////////TICKET #896
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (fsys::exists (modulePathName))
|
||||
{
|
||||
INFO (config, "found module %s", modulePathName.string().c_str());
|
||||
return modulePathName.string();
|
||||
return modulePathName.string(); ///////////TICKET #896
|
||||
}
|
||||
|
||||
// try / continue search path
|
||||
if (searchLocation.isValid())
|
||||
modulePathName = fsys::path() / searchLocation.next() / moduleName;
|
||||
else
|
||||
throw error::Config ("Module \""+moduleName+"\" not found"
|
||||
throw error::Config ("Module \""+moduleName.string()+"\" not found" /////TICKET #896
|
||||
+ (searchPath.empty()? ".":" in search path: "+searchPath));
|
||||
} }
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ namespace lib {
|
|||
* @return the absolute pathname of the module file found
|
||||
* @throws error::Config when the resolution fails
|
||||
*/
|
||||
string resolveModulePath (string moduleName, string searchPath = "");
|
||||
string resolveModulePath (fsys::path moduleName, string searchPath = "");
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue