X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FQtx%2FQtx.cxx;h=919adfaf39eff28deac1151c0b1b8b9ea1e642a3;hb=6ebe476d3bc01ddc4f7529ff63807a8153a6cb95;hp=f050d032862e7589523d80ae4acb41473d58b9a3;hpb=1a722284b39e97a80734f5100037cfce3fc311df;p=modules%2Fgui.git diff --git a/src/Qtx/Qtx.cxx b/src/Qtx/Qtx.cxx index f050d0328..919adfaf3 100644 --- a/src/Qtx/Qtx.cxx +++ b/src/Qtx/Qtx.cxx @@ -439,22 +439,52 @@ QString Qtx::extension( const QString& path, const bool full ) return full ? QFileInfo( path ).completeSuffix() : QFileInfo( path ).suffix(); } +/*! + \brief EXtract base library name. + + The function removes platform-specific prefix (lib) and suffix (.dll/.so) + from the library file name. + For example, if \a str = "libmylib.so", "mylib" is returned.. + + \param libName library name + \return base library name +*/ +QString Qtx::libraryName( const QString& libName ) +{ + QString fullName = file( libName ); +#if defined(WIN32) + QString libExt = QString( "dll" ); +#elif defined(__APPLE__) + QString libExt = QString( "dylib" ); +#else + QString libExt = QString( "so" ); +#endif + if ( extension( fullName ).toLower() == libExt ) + fullName.truncate( fullName.length() - libExt.length() - 1 ); +#ifndef WIN32 + QString prefix = QString( "lib" ); + if ( fullName.startsWith( prefix ) ) + fullName.remove( 0, prefix.length() ); +#endif + return fullName; +} + /*! \brief Convert the given parameter to the platform-specific library name. The function appends platform-specific prefix (lib) and suffix (.dll/.so) to the library file name. - For example, if \a str = "mylib", "libmylib.so" is returned for Linux and + For example, if \a libName = "mylib", "libmylib.so" is returned for Linux and mylib.dll for Windows. - \param str short library name + \param libName short library name \return full library name */ -QString Qtx::library( const QString& str ) +QString Qtx::library( const QString& libName ) { - QString path = dir( str, false ); - QString name = file( str, false ); - QString ext = extension( str ); + QString path = dir( libName, false ); + QString name = file( libName, false ); + QString ext = extension( libName ); #ifndef WIN32 if ( !name.startsWith( "lib" ) ) @@ -556,6 +586,17 @@ QString Qtx::addSlash( const QString& path ) return res; } +/*! + \brief Return full path obtained by joining given components with + the native directory separator. + \param path Separate path components + \return complete path +*/ +QString Qtx::joinPath( const QStringList& path ) +{ + return path.join( QDir::separator() ); +} + /*! \brief Convert text file from DOS format to UNIX.