This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
POSIX-style ECOS_REPOSITORY for Cygwin configtool
- From: John Dallaway <jld at ecoscentric dot com>
- To: ecos-patches at sources dot redhat dot com
- Date: Fri, 11 Apr 2003 13:59:47 +0100
- Subject: POSIX-style ECOS_REPOSITORY for Cygwin configtool
- Organization: eCosCentric Limited
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/ChangeLog,v
retrieving revision 1.32.2.15
diff -u -5 -r1.32.2.15 ChangeLog
--- ChangeLog 10 Apr 2003 15:29:49 -0000 1.32.2.15
+++ ChangeLog 11 Apr 2003 10:07:43 -0000
@@ -1,5 +1,13 @@
+2003-04-11 John Dallaway <jld at ecoscentric dot 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 at ecoscentric dot com>
* standalone/wxwin/docsystem.cpp: Eliminate pop-up warning when
attempting to create a directory under $HOME/.eCosDocs/ which already
exists.
Index: standalone/wxwin/appsettings.cpp
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/appsettings.cpp,v
retrieving revision 1.7.2.4
diff -u -5 -r1.7.2.4 appsettings.cpp
--- standalone/wxwin/appsettings.cpp 7 Apr 2003 16:09:48 -0000 1.7.2.4
+++ standalone/wxwin/appsettings.cpp 11 Apr 2003 10:08:02 -0000
@@ -597,21 +597,22 @@
if (!envVarValue.IsEmpty())
{
// 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);
m_strRepository = envVarValue;
}
}
#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");
#endif
Index: standalone/wxwin/ecutils.cpp
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/ecutils.cpp,v
retrieving revision 1.5
diff -u -5 -r1.5 ecutils.cpp
--- standalone/wxwin/ecutils.cpp 20 Jan 2003 15:12:12 -0000 1.5
+++ standalone/wxwin/ecutils.cpp 11 Apr 2003 10:08:06 -0000
@@ -1,9 +1,10 @@
//####COPYRIGHTBEGIN####
//
// ----------------------------------------------------------------------------
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
+// Copyright (C) 2003 John Dallaway
//
// This program is part of the eCos host tools.
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
@@ -25,11 +26,11 @@
//
//===========================================================================
//===========================================================================
//#####DESCRIPTIONBEGIN####
//
-// Author(s): sdf
+// Author(s): sdf, jld
// Contact(s): sdf
// Date: 1998/08/11
// Version: 0.01
// Purpose:
// Description: This is a collection of utility functions.
@@ -69,10 +70,14 @@
#ifdef __WXMSW__
#include <tlhelp32.h>
#endif
+#ifdef __CYGWIN__
+#include <sys/cygwin.h> /* for cygwin_conv_to_*_path() */
+#endif
+
#if 0
#define INCLUDEFILE <string>
#include "IncludeSTL.h"
@@ -254,10 +259,44 @@
wxString str;
str.LoadString(id);
return str;
}
#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;
Index: standalone/wxwin/ecutils.h
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/ecutils.h,v
retrieving revision 1.4
diff -u -5 -r1.4 ecutils.h
--- standalone/wxwin/ecutils.h 20 Jan 2003 15:12:12 -0000 1.4
+++ standalone/wxwin/ecutils.h 11 Apr 2003 10:08:06 -0000
@@ -1,9 +1,10 @@
//####COPYRIGHTBEGIN####
//
// ----------------------------------------------------------------------------
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
+// Copyright (C) 2003 John Dallaway
//
// This program is part of the eCos host tools.
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
@@ -23,11 +24,11 @@
//
//####COPYRIGHTEND####
//===========================================================================
//#####DESCRIPTIONBEGIN####
//
-// Author(s): sdf
+// Author(s): sdf, jld
// Contact(s): sdf
// Date: 1998/08/11
// Version: 0.01
// Purpose:
// Description: Interface to various global utility functions. Everything in this
@@ -74,10 +75,12 @@
#if 0
static bool Launch (const ecFileName &strFileName,const ecFileName &strViewer);
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
static const wxString LoadString (UINT id);