patch to fix various filename-related functions for cygwin
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13829 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -270,12 +270,15 @@ WXDLLEXPORT bool wxRmdir(const wxString& dir, int flags = 0);
|
|||||||
#define wxPATH_SEP_MAC wxT(";")
|
#define wxPATH_SEP_MAC wxT(";")
|
||||||
|
|
||||||
// platform independent versions
|
// platform independent versions
|
||||||
#if defined(__UNIX__)
|
#if defined(__UNIX__) && !defined(__GNUWIN32__)
|
||||||
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX
|
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX
|
||||||
#define wxPATH_SEP wxPATH_SEP_UNIX
|
#define wxPATH_SEP wxPATH_SEP_UNIX
|
||||||
#elif defined(__MAC__)
|
#elif defined(__MAC__)
|
||||||
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_MAC
|
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_MAC
|
||||||
#define wxPATH_SEP wxPATH_SEP_MAC
|
#define wxPATH_SEP wxPATH_SEP_MAC
|
||||||
|
#elif defined(__GNUWIN32__) // Cygwin
|
||||||
|
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS
|
||||||
|
#define wxPATH_SEP wxPATH_SEP_UNIX
|
||||||
#else // Windows and OS/2
|
#else // Windows and OS/2
|
||||||
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS
|
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS
|
||||||
#define wxPATH_SEP wxPATH_SEP_DOS
|
#define wxPATH_SEP wxPATH_SEP_DOS
|
||||||
|
@@ -93,13 +93,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUWIN32__
|
|
||||||
#include <wchar.h>
|
|
||||||
#ifndef __TWIN32__
|
|
||||||
#include <sys/unistd.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__ // Please someone tell me which version of Borland needs
|
#ifdef __BORLANDC__ // Please someone tell me which version of Borland needs
|
||||||
// this (3.1 I believe) and how to test for it.
|
// this (3.1 I believe) and how to test for it.
|
||||||
// If this works for Borland 4.0 as well, then no worries.
|
// If this works for Borland 4.0 as well, then no worries.
|
||||||
@@ -121,7 +114,18 @@
|
|||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
|
||||||
|
// sys/cygwin.h is needed for cygwin_conv_to_full_win32_path()
|
||||||
|
//
|
||||||
|
// note that it must be included after <windows.h>
|
||||||
|
#ifdef __GNUWIN32__
|
||||||
|
#include <sys/cygwin.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
#ifndef __TWIN32__
|
||||||
|
#include <sys/unistd.h>
|
||||||
|
#endif
|
||||||
|
#endif // __GNUWIN32__
|
||||||
|
#endif // __WINDOWS__
|
||||||
|
|
||||||
// TODO: Borland probably has _wgetcwd as well?
|
// TODO: Borland probably has _wgetcwd as well?
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -1456,11 +1460,11 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
|
|||||||
}
|
}
|
||||||
#endif // __DJGPP__
|
#endif // __DJGPP__
|
||||||
|
|
||||||
#ifdef __CYGWIN10__
|
#ifdef __GNUWIN32__
|
||||||
// another example of DOS/Unix mix
|
// another example of DOS/Unix mix (Cygwin)
|
||||||
wxString pathUnix = buf;
|
wxString pathUnix = buf;
|
||||||
cygwin_conv_to_full_win32_path(pathUnix, buf);
|
cygwin_conv_to_full_win32_path(pathUnix, buf);
|
||||||
#endif // __CYGWIN10__
|
#endif // __GNUWIN32__
|
||||||
|
|
||||||
// finally convert the result to Unicode if needed
|
// finally convert the result to Unicode if needed
|
||||||
#if wxUSE_UNICODE && !defined(HAVE_WGETCWD)
|
#if wxUSE_UNICODE && !defined(HAVE_WGETCWD)
|
||||||
|
@@ -64,6 +64,7 @@ extern "C" {
|
|||||||
#if defined(__GNUWIN32__) && !defined(__TWIN32__)
|
#if defined(__GNUWIN32__) && !defined(__TWIN32__)
|
||||||
#include <sys/unistd.h>
|
#include <sys/unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/cygwin.h> // for cygwin_conv_to_full_win32_path()
|
||||||
#endif //GNUWIN32
|
#endif //GNUWIN32
|
||||||
|
|
||||||
#ifdef __BORLANDC__ // Please someone tell me which version of Borland needs
|
#ifdef __BORLANDC__ // Please someone tell me which version of Borland needs
|
||||||
@@ -372,6 +373,13 @@ const wxChar* wxGetHomeDir(wxString *pstr)
|
|||||||
// add a trailing slash if needed
|
// add a trailing slash if needed
|
||||||
if ( strDir.Last() != wxT('/') )
|
if ( strDir.Last() != wxT('/') )
|
||||||
strDir << wxT('/');
|
strDir << wxT('/');
|
||||||
|
|
||||||
|
#ifdef __GNUWIN32__
|
||||||
|
// Cygwin returns unix type path but that does not work well
|
||||||
|
static wxChar windowsPath[MAX_PATH];
|
||||||
|
cygwin_conv_to_full_win32_path(strDir, windowsPath);
|
||||||
|
strDir = windowsPath;
|
||||||
|
#endif
|
||||||
#else // Windows
|
#else // Windows
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
const wxChar *szHome = wxGetenv(wxT("HOMEDRIVE"));
|
const wxChar *szHome = wxGetenv(wxT("HOMEDRIVE"));
|
||||||
|
Reference in New Issue
Block a user