Salome HOME
PR : merge branch V1_2c dans branche principale pour V1_3_0_b1
[modules/kernel.git] / src / SALOMEGUI / QAD_ResourceMgr.cxx
index 19ce185d33ba9e676a5cf81f75270d3c4e5ef193..d116c7b33a1108d75134342ad2dac403f3e6fa3f 100644 (file)
@@ -1,13 +1,32 @@
-using namespace std;
-//  File      : QAD_ResourceMgr.cxx
-//  Created   : UI team, 22.10.00
-//  Descr     : ResourceMgr QAD-based application
-//  Author    : UI team
-//  Project   : SALOME
-//  Module    : SALOMEGUI
-//  Copyright : Open CASCADE
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : QAD_ResourceMgr.cxx
+//  Author : UI team
+//  Module : SALOME
 //  $Header$
 
+using namespace std;
 /*!
   \class QAD_ResourceMgr QAD_ResourceMgr.h
   \brief ResourceMgr QAD-based application.
@@ -221,11 +240,10 @@ QString QAD_ResourceMgr::resources( const char* prefix ) const
   Collects list of directories, separated by ';' where resources for module 'prefix'
   can be situated
   The order is following : 
+  - <prefix>_ROOT_DIR/share/salome/resources directory
   - CSF_<prefix>Resources env.var directory ( or directory list )
-  - CSF_ResourcesDefaults env.var directory ( or directory list )
   - ${HOME}/.salome/resources directory
-  - ${SALOME_SITE_DIR}/share/salome/resources directory
-  - ${SALOME_ROOT_DIR}/share/salome/resources directory
+  - KERNEL_ROOT_DIR/share/salome/resources directory
 */
 QString QAD_ResourceMgr::collectDirs( const QString& prefix ) const
 {
@@ -234,6 +252,24 @@ QString QAD_ResourceMgr::collectDirs( const QString& prefix ) const
   QString dir;
   char* cenv;
   
+  if ( !prefix.isEmpty() ) {
+    envVar = prefix.latin1() + QCString( "_ROOT_DIR" );
+    cenv = getenv( ( const char* ) envVar );
+    if ( cenv ) {
+      dir.sprintf( "%s", cenv );
+      if ( !dir.isEmpty() ) {
+       dir = QAD_Tools::addSlash(dir) ;
+       dir = dir + "share" ;
+       dir = QAD_Tools::addSlash(dir) ;
+       dir = dir + "salome" ;
+       dir = QAD_Tools::addSlash(dir) ;
+       dir = dir + "resources" ;
+       dir = QAD_Tools::addSlash(dir) ;
+       dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) );
+      }
+    }
+  }
+
   // Try CSF_<prefix>Resources env.var directory ( or directory list )
   if ( !prefix.isEmpty() ) {
     envVar = QCString( "CSF_" ) + prefix.latin1() + QCString( "Resources" );
@@ -244,13 +280,6 @@ QString QAD_ResourceMgr::collectDirs( const QString& prefix ) const
        dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) );
     }
   }
-  // Try CSF_ResourcesDefaults env.var directory ( or directory list )
-  cenv = getenv( "CSF_ResourcesDefaults" );
-  if ( cenv ) {
-    dir.sprintf( "%s", cenv );
-    if ( !dir.isEmpty() )
-      dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) );
-  }
   // Try ${HOME}/.salome/resources directory
   cenv = getenv( "HOME" );
   if ( cenv ) {
@@ -264,23 +293,9 @@ QString QAD_ResourceMgr::collectDirs( const QString& prefix ) const
       dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) );
     }
   }
-  // Try ${SALOME_SITE_DIR}/share/salome/resources directory
-  cenv = getenv( "SALOME_SITE_DIR" );
-  if ( cenv ) {
-    dir.sprintf( "%s", cenv );
-    if ( !dir.isEmpty() ) {
-      dir = QAD_Tools::addSlash(dir) ;
-      dir = dir + "share" ;
-      dir = QAD_Tools::addSlash(dir) ;
-      dir = dir + "salome" ;
-      dir = QAD_Tools::addSlash(dir) ;
-      dir = dir + "resources" ;
-      dir = QAD_Tools::addSlash(dir) ;
-      dirList.append( dirList.isEmpty() ? dir : ( QString( SEPARATOR ) + dir ) );
-    }
-  }
-  // Try ${SALOME_ROOT_DIR}/share/salome/resources directory
-  cenv = getenv( "SALOME_ROOT_DIR" );
+
+  // Try ${KERNEL_ROOT_DIR}/share/salome/resources directory
+  cenv = getenv( "KERNEL_ROOT_DIR" );
   if ( cenv ) {
     dir.sprintf( "%s", cenv );
     if ( !dir.isEmpty() ) {