Change in policy for duplicate libraries.
* Change: In CRL Core, replace duplicated libraries, even when performing a Append/Prepend operation. Also correct a bug in library name uniquification, event if it's no used. The policy in cas of duplicate libraries is not completly clear for me, still.
This commit is contained in:
parent
445104eaf7
commit
9ac199f11b
|
@ -336,8 +336,8 @@ namespace CRL {
|
||||||
AllianceLibrary* library = getAllianceLibrary ( dupLibName, flags );
|
AllianceLibrary* library = getAllianceLibrary ( dupLibName, flags );
|
||||||
if (library == NULL) break;
|
if (library == NULL) break;
|
||||||
|
|
||||||
ostringstream oss (libName);
|
ostringstream oss;
|
||||||
oss << "." << duplicate;
|
oss << libName << "." << duplicate;
|
||||||
dupLibName = oss.str();
|
dupLibName = oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -702,8 +702,14 @@ namespace CRL {
|
||||||
|
|
||||||
void Environment::addSYSTEM_LIBRARY ( const char* value, const char* libName, unsigned int mode )
|
void Environment::addSYSTEM_LIBRARY ( const char* value, const char* libName, unsigned int mode )
|
||||||
{
|
{
|
||||||
if ( mode == Prepend ) { _LIBRARIES.prepend(value,libName); return; }
|
if ((mode == Prepend) or (mode == Append)) {
|
||||||
if ( mode == Append ) { _LIBRARIES.append (value,libName); return; }
|
size_t duplicate = _LIBRARIES.hasLib(libName);
|
||||||
|
if (duplicate != SearchPath::npos) _LIBRARIES.remove( duplicate );
|
||||||
|
|
||||||
|
if (mode == Prepend) _LIBRARIES.prepend(value,libName);
|
||||||
|
if (mode == Append ) _LIBRARIES.append (value,libName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string newLibName = libName;
|
string newLibName = libName;
|
||||||
for ( size_t i=0 ; i < _LIBRARIES.getSize() ; ++i ) {
|
for ( size_t i=0 ; i < _LIBRARIES.getSize() ; ++i ) {
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
|
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//
|
//
|
||||||
// This file is part of the Coriolis Software.
|
// This file is part of the Coriolis Software.
|
||||||
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
|
// Copyright (c) UPMC 2008-2015, All Rights Reserved
|
||||||
//
|
//
|
||||||
// ===================================================================
|
// +-----------------------------------------------------------------+
|
||||||
//
|
|
||||||
// $Id$
|
|
||||||
//
|
|
||||||
// x-----------------------------------------------------------------x
|
|
||||||
// | |
|
|
||||||
// | C O R I O L I S |
|
// | C O R I O L I S |
|
||||||
// | Alliance / Hurricane Interface |
|
// | Alliance / Hurricane Interface |
|
||||||
// | |
|
// | |
|
||||||
|
@ -17,23 +11,12 @@
|
||||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||||
// | =============================================================== |
|
// | =============================================================== |
|
||||||
// | C++ Module : "./SearchPath.cpp" |
|
// | C++ Module : "./SearchPath.cpp" |
|
||||||
// | *************************************************************** |
|
// +-----------------------------------------------------------------+
|
||||||
// | U p d a t e s |
|
|
||||||
// | |
|
|
||||||
// x-----------------------------------------------------------------x
|
|
||||||
|
|
||||||
|
|
||||||
#include "crlcore/SearchPath.h"
|
#include "crlcore/SearchPath.h"
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
} // End of anonymous namespace.
|
|
||||||
|
|
||||||
|
|
||||||
namespace CRL {
|
namespace CRL {
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -106,6 +89,10 @@ namespace CRL {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SearchPath::remove ( size_t index )
|
||||||
|
{ if (index < _paths.size()) _paths.erase( _paths.begin()+index ); }
|
||||||
|
|
||||||
|
|
||||||
void SearchPath::select ( const string& path )
|
void SearchPath::select ( const string& path )
|
||||||
{
|
{
|
||||||
for ( size_t ipath=0 ; ipath < _paths.size() ; ++ipath ) {
|
for ( size_t ipath=0 ; ipath < _paths.size() ; ++ipath ) {
|
||||||
|
@ -143,6 +130,14 @@ namespace CRL {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t SearchPath::hasLib ( const string& name ) const
|
||||||
|
{
|
||||||
|
for ( size_t i=0 ; i < _paths.size() ; i++ )
|
||||||
|
if ( _paths[i].getName() == name ) return i;
|
||||||
|
return npos;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const SearchPath::Element& SearchPath::operator[] ( size_t index ) const
|
const SearchPath::Element& SearchPath::operator[] ( size_t index ) const
|
||||||
{
|
{
|
||||||
static Element nullElement;
|
static Element nullElement;
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
|
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//
|
//
|
||||||
// This file is part of the Coriolis Software.
|
// This file is part of the Coriolis Software.
|
||||||
// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
|
// Copyright (c) UPMC 2008-2015, All Rights Reserved
|
||||||
//
|
//
|
||||||
// +-----------------------------------------------------------------+
|
// +-----------------------------------------------------------------+
|
||||||
// | C O R I O L I S |
|
// | C O R I O L I S |
|
||||||
|
@ -15,20 +14,17 @@
|
||||||
// +-----------------------------------------------------------------+
|
// +-----------------------------------------------------------------+
|
||||||
|
|
||||||
|
|
||||||
#ifndef __CRL_SEARCH_PATH__
|
#ifndef CRL_SEARCH_PATH_H
|
||||||
# define __CRL_SEARCH_PATH__
|
#define CRL_SEARCH_PATH_H
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "hurricane/Commons.h"
|
#include "hurricane/Commons.h"
|
||||||
#include "hurricane/Slot.h"
|
#include "hurricane/Slot.h"
|
||||||
|
|
||||||
|
|
||||||
namespace CRL {
|
namespace CRL {
|
||||||
|
|
||||||
|
|
||||||
using Hurricane::Record;
|
using Hurricane::Record;
|
||||||
using Hurricane::_TName;
|
using Hurricane::_TName;
|
||||||
|
|
||||||
|
@ -57,6 +53,7 @@ namespace CRL {
|
||||||
inline void append ( const std::string& path, const std::string& name="" );
|
inline void append ( const std::string& path, const std::string& name="" );
|
||||||
void prepend ( const std::string& path, const std::string& name="");
|
void prepend ( const std::string& path, const std::string& name="");
|
||||||
void replace ( const std::string& path, const std::string&, size_t index );
|
void replace ( const std::string& path, const std::string&, size_t index );
|
||||||
|
void remove ( size_t index );
|
||||||
size_t locate ( const std::string& file
|
size_t locate ( const std::string& file
|
||||||
, std::ios::openmode mode =std::ios::in
|
, std::ios::openmode mode =std::ios::in
|
||||||
, int first=0
|
, int first=0
|
||||||
|
@ -66,6 +63,7 @@ namespace CRL {
|
||||||
inline const std::string& getSelected () const;
|
inline const std::string& getSelected () const;
|
||||||
inline size_t getIndex () const;
|
inline size_t getIndex () const;
|
||||||
inline bool hasSelected () const;
|
inline bool hasSelected () const;
|
||||||
|
size_t hasLib ( const std::string& name ) const;
|
||||||
size_t hasPath ( const std::string& path ) const;
|
size_t hasPath ( const std::string& path ) const;
|
||||||
const Element& operator[] ( size_t index ) const;
|
const Element& operator[] ( size_t index ) const;
|
||||||
private:
|
private:
|
||||||
|
@ -109,11 +107,11 @@ namespace CRL {
|
||||||
inline std::string SearchPath::Element::_getTypeName () const { return "SearchPath::Element"; }
|
inline std::string SearchPath::Element::_getTypeName () const { return "SearchPath::Element"; }
|
||||||
|
|
||||||
|
|
||||||
} // End of CRL namespace.
|
} // CRL namespace.
|
||||||
|
|
||||||
|
|
||||||
INSPECTOR_P_SUPPORT(CRL::SearchPath);
|
INSPECTOR_P_SUPPORT(CRL::SearchPath);
|
||||||
INSPECTOR_V_SUPPORT(CRL::SearchPath::Element);
|
INSPECTOR_V_SUPPORT(CRL::SearchPath::Element);
|
||||||
|
|
||||||
|
|
||||||
# endif
|
#endif // CRL_SEARCH_PATH_H
|
||||||
|
|
Loading…
Reference in New Issue