Attached Files | conversion.patch [^] (4,753 bytes) 1969-12-31 19:00 [Show Content] [Hide Content]Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.171
diff -u -3 -p -r1.171 cmake.cxx
--- cmake.cxx 26 Aug 2004 18:55:55 -0000 1.171
+++ cmake.cxx 21 Sep 2004 21:28:56 -0000
@@ -40,6 +40,7 @@
#endif
#include <stdlib.h> // required for atoi
+#include <fstream>
#ifdef __APPLE__
#include <sys/types.h>
@@ -983,6 +984,9 @@ int cmake::DoPreConfigureChecks()
int cmake::Configure()
{
+ // Construct right now our path conversion table before it's too late:
+ this->UpdateConversionPathTable();
+
int res = 0;
if ( !m_ScriptMode )
{
@@ -1506,3 +1510,28 @@ void cmake::CleanupWrittenFiles()
{
m_WrittenFiles.clear();
}
+
+void cmake::UpdateConversionPathTable()
+{
+ // This one should always be there it fix a bug on sgi
+ if( !cmSystemTools::TranslationMap.size() )
+ {
+ cmSystemTools::TranslationMap.insert(
+ std::pair<std::string,std::string>("/tmp_mnt", "") );
+ }
+
+ const char* tablepath =
+ m_CacheManager->GetCacheValue("CMAKE_PATH_TRANSLATION_FILE");
+
+ std::ifstream table( tablepath );
+ std::string a, b;
+ if( table.is_open() && table.good() )
+ {
+ while(!table.eof())
+ {
+ // two entries per line
+ table >> a; table >> b;
+ cmSystemTools::InsertTranslationKey( a, b);
+ }
+ }
+}
Index: cmake.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.h,v
retrieving revision 1.47
diff -u -3 -p -r1.47 cmake.h
--- cmake.h 17 Aug 2004 19:36:08 -0000 1.47
+++ cmake.h 21 Sep 2004 21:28:56 -0000
@@ -1,5 +1,3 @@
-#ifndef cmake_h
-#define cmake_h
/*=========================================================================
Program: CMake - Cross-Platform Makefile Generator
@@ -39,6 +37,9 @@
//
+#ifndef cmake_h
+#define cmake_h
+
#include "cmSystemTools.h"
class cmGlobalGenerator;
@@ -309,6 +310,8 @@ private:
std::string m_CXXEnvironment;
std::string m_CCEnvironment;
bool m_DebugTryCompile;
+
+ void UpdateConversionPathTable();
};
#define CMAKE_STANDARD_OPTIONS_TABLE \
Index: kwsys/SystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.cxx,v
retrieving revision 1.57
diff -u -3 -p -r1.57 SystemTools.cxx
--- kwsys/SystemTools.cxx 16 Sep 2004 16:39:02 -0000 1.57
+++ kwsys/SystemTools.cxx 21 Sep 2004 21:28:56 -0000
@@ -1436,8 +1436,17 @@ kwsys_stl::string SystemTools::CollapseF
return SystemTools::CollapseFullPath(in_relative, 0);
}
+kwsys_stl::map<kwsys_stl::string,kwsys_stl::string> SystemTools::TranslationMap;
+
+void SystemTools::InsertTranslationKey(kwsys_stl::string const & a,
+ kwsys_stl::string const & b)
+{
+ TranslationMap.insert(
+ kwsys_stl::pair<kwsys_stl::string,kwsys_stl::string>(a, b));
+}
+
kwsys_stl::string SystemTools::CollapseFullPath(const char* in_relative,
- const char* in_base)
+ const char* in_base)
{
// Save original working directory.
kwsys_stl::string orig = SystemTools::GetCurrentWorkingDirectory();
@@ -1491,10 +1500,16 @@ kwsys_stl::string SystemTools::CollapseF
{
newDir = SystemTools::GetCurrentWorkingDirectory();
}
- // if there is a /tmp_mnt in a path get rid of it!
- if(newDir.find("/tmp_mnt") == 0)
+
+ kwsys_stl::map<kwsys_stl::string,kwsys_stl::string>::const_iterator it;
+ for(it = TranslationMap.begin();
+ it != TranslationMap.end();
+ ++it )
{
- newDir = newDir.substr(8);
+ if(newDir.find( it->first ) == 0)
+ {
+ newDir = newDir.replace( 0, it->first.size(), it->second);
+ }
}
#endif
Index: kwsys/SystemTools.hxx.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.hxx.in,v
retrieving revision 1.16
diff -u -3 -p -r1.16 SystemTools.hxx.in
--- kwsys/SystemTools.hxx.in 16 Sep 2004 14:58:56 -0000 1.16
+++ kwsys/SystemTools.hxx.in 21 Sep 2004 21:28:56 -0000
@@ -17,6 +17,7 @@
#include <@KWSYS_NAMESPACE@/ios/iosfwd>
#include <@KWSYS_NAMESPACE@/stl/string>
#include <@KWSYS_NAMESPACE@/stl/vector>
+#include <@KWSYS_NAMESPACE@/stl/map>
#include <@KWSYS_NAMESPACE@/Configure.h>
@@ -284,6 +285,9 @@ public:
*/
static int GetTerminalWidth();
+ static void InsertTranslationKey(kwsys_stl::string const & a, kwsys_stl::string const & b);
+ static kwsys_stl::map<kwsys_stl::string,kwsys_stl::string> TranslationMap;
+
protected:
// these two functions can be called from ConvertToOutputPath
/**
|