changeset 931:d7c9117adc25

* standalone/wxwin/ecutils.cpp, standalone/wxwin/ecutils.h: Create wxString wrappers for cygwin_conv_to_*_path(). * standalone/wxwin/appsettings.cpp: Accommodate POSIX-style values of the ECOS_REPOSITORY environment variable.
author jld
date Fri, 11 Apr 2003 10:22:36 +0000
parents c978ff8efbfc
children d142fcd415a0
files host/tools/configtool/ChangeLog host/tools/configtool/standalone/wxwin/appsettings.cpp host/tools/configtool/standalone/wxwin/ecutils.cpp host/tools/configtool/standalone/wxwin/ecutils.h
diffstat 4 files changed, 54 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/host/tools/configtool/ChangeLog
+++ b/host/tools/configtool/ChangeLog
@@ -1,3 +1,11 @@
+2003-04-11  John Dallaway  <jld@ecoscentric.com>
+
+	* standalone/wxwin/ecutils.cpp, standalone/wxwin/ecutils.h: Create
+	wxString wrappers for cygwin_conv_to_*_path().
+
+	* standalone/wxwin/appsettings.cpp: Accommodate POSIX-style values of
+	the ECOS_REPOSITORY environment variable.
+
 2003-04-10  John Dallaway  <jld@ecoscentric.com>
 
 	* standalone/wxwin/docsystem.cpp: Eliminate pop-up warning when
--- a/host/tools/configtool/standalone/wxwin/appsettings.cpp
+++ b/host/tools/configtool/standalone/wxwin/appsettings.cpp
@@ -598,6 +598,7 @@ bool ecSettings::LoadConfig()
             // Note that ECOS_REPOSITORY has the packages (or ecc) folder in the name.
             // In order to be in the form that is compatible with configtool operation,
             // it needs to have that stripped off.
+            envVarValue = ecUtils::PosixToNativePath(envVarValue); // accommodate posix-style ECOS_REPOSITORY value under Cygwin
             wxString packagesName = wxFileNameFromPath(envVarValue);
             if (packagesName == wxT("ecc") || packagesName == wxT("packages"))
                 envVarValue = wxPathOnly(envVarValue);
@@ -608,7 +609,7 @@ bool ecSettings::LoadConfig()
 
 #ifdef __WXMSW__
     if (m_userToolsDir.IsEmpty())
-        m_userToolsDir =  GetCygwinInstallPath() + wxT("\\bin");
+        m_userToolsDir = GetCygwinInstallPath() + wxT("\\bin");
 #else
     if (m_userToolsDir.IsEmpty())
         m_userToolsDir = wxT("/bin");
--- a/host/tools/configtool/standalone/wxwin/ecutils.cpp
+++ b/host/tools/configtool/standalone/wxwin/ecutils.cpp
@@ -2,6 +2,7 @@
 //                                                                          
 // ----------------------------------------------------------------------------
 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
+// Copyright (C) 2003 John Dallaway
 //
 // This program is part of the eCos host tools.
 //
@@ -27,7 +28,7 @@
 //===========================================================================
 //#####DESCRIPTIONBEGIN####
 //
-// Author(s): 	sdf
+// Author(s): 	sdf, jld
 // Contact(s):	sdf
 // Date:		1998/08/11
 // Version:		0.01
@@ -71,6 +72,10 @@
 #include <tlhelp32.h>
 #endif
 
+#ifdef __CYGWIN__
+#include <sys/cygwin.h> /* for cygwin_conv_to_*_path() */
+#endif
+
 #if 0
 
 #define INCLUDEFILE <string>
@@ -257,6 +262,40 @@ const wxString ecUtils::LoadString(UINT 
 }
 #endif
 
+const wxString ecUtils::NativeToPosixPath(const wxString & native)
+{
+#ifdef __CYGWIN__
+    if (native.IsEmpty())
+        return native;
+    else
+    {
+        wxString posix;
+        cygwin_conv_to_posix_path(native.c_str(), posix.GetWriteBuf(MAXPATHLEN + 1));
+        posix.UngetWriteBuf();
+        return posix;
+    }
+#else
+    return native;
+#endif
+}
+
+const wxString ecUtils::PosixToNativePath(const wxString & posix)
+{
+#ifdef __CYGWIN__
+    if (posix.IsEmpty())
+        return posix;
+    else
+    {
+        wxString native;
+        cygwin_conv_to_win32_path(posix.c_str(), native.GetWriteBuf(MAXPATHLEN + 1));
+        native.UngetWriteBuf();
+        return native;
+    }
+#else
+    return posix;
+#endif
+}
+
 bool ecUtils::AddToPath(const ecFileName & strFolder, bool bAtFront)
 {
     wxString strPath,strOldPath;
--- a/host/tools/configtool/standalone/wxwin/ecutils.h
+++ b/host/tools/configtool/standalone/wxwin/ecutils.h
@@ -2,6 +2,7 @@
 //                                                                          
 // ----------------------------------------------------------------------------
 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
+// Copyright (C) 2003 John Dallaway
 //
 // This program is part of the eCos host tools.
 //
@@ -25,7 +26,7 @@
 //===========================================================================
 //#####DESCRIPTIONBEGIN####
 //
-// Author(s): 	sdf
+// Author(s): 	sdf, jld
 // Contact(s):	sdf
 // Date:		1998/08/11
 // Version:		0.01
@@ -76,6 +77,8 @@ public:
     static wxString GetLastErrorMessageString ();
 #endif    
 
+    static const wxString PosixToNativePath(const wxString & posix);
+    static const wxString NativeToPosixPath(const wxString & native);
     static bool AddToPath (const ecFileName &strFolder, bool bAtFront=true);
 
 #if 0