Support native-style paths on DOS/DJGPP
This commit is contained in:
parent
c18af8953c
commit
0d8bdcc4d8
|
@ -87,6 +87,9 @@
|
|||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#undef HAVE_SYS_SOCKET_H
|
||||
|
||||
|
|
|
@ -5694,7 +5694,7 @@ fi
|
|||
|
||||
done
|
||||
|
||||
for ac_header in unistd.h syslog.h langinfo.h sys/statfs.h
|
||||
for ac_header in unistd.h syslog.h langinfo.h sys/statfs.h sys/select.h
|
||||
do :
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
||||
|
|
|
@ -68,7 +68,7 @@ AC_CHECK_HEADERS(sys/mount.h,,,
|
|||
#endif
|
||||
]])
|
||||
AC_CHECK_HEADERS(sys/ustat.h sys/sysmacros.h sys/syslog.h sys/socket.h)
|
||||
AC_CHECK_HEADERS(unistd.h syslog.h langinfo.h sys/statfs.h)
|
||||
AC_CHECK_HEADERS(unistd.h syslog.h langinfo.h sys/statfs.h sys/select.h)
|
||||
AC_CHECK_HEADERS(signum.h bits/signum.h, break )
|
||||
AC_CHECK_HEADERS(stdarg.h varargs.h, break )
|
||||
|
||||
|
|
|
@ -143,8 +143,8 @@ public:
|
|||
};
|
||||
|
||||
|
||||
#if IS_AROS
|
||||
class cArosPath
|
||||
#if USES_DEVICE_PATH
|
||||
class cDevicePath
|
||||
{
|
||||
public:
|
||||
static TSTRING AsPosix(const TSTRING& in);
|
||||
|
|
|
@ -143,13 +143,13 @@ cFile::~cFile()
|
|||
// Open
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __AROS
|
||||
#if !USES_DEVICE_PATH
|
||||
void cFile::Open( const TSTRING& sFileName, uint32 flags )
|
||||
{
|
||||
#else
|
||||
void cFile::Open( const TSTRING& sFileNameC, uint32 flags )
|
||||
{
|
||||
TSTRING sFileName = cArosPath::AsNative(sFileNameC);
|
||||
TSTRING sFileName = cDevicePath::AsNative(sFileNameC);
|
||||
#endif
|
||||
mode_t openmode = 0664;
|
||||
if (mpData->mpCurrStream != NULL)
|
||||
|
@ -458,30 +458,51 @@ void cFile::Truncate( File_t offset ) // throw(eFile)
|
|||
}
|
||||
|
||||
|
||||
#if IS_AROS
|
||||
TSTRING cArosPath::AsPosix( const TSTRING& in )
|
||||
#if USES_DEVICE_PATH
|
||||
// For paths of type DH0:/dir/file
|
||||
TSTRING cDevicePath::AsPosix( const TSTRING& in )
|
||||
{
|
||||
if (in[0] == '/')
|
||||
return in;
|
||||
|
||||
#if IS_DOS_DJGPP
|
||||
TSTRING out = "/dev/" + in;
|
||||
std::replace(out.begin(), out.end(), '\\', '/');
|
||||
#else
|
||||
TSTRING out = '/' + in;
|
||||
#endif
|
||||
|
||||
std::replace(out.begin(), out.end(), ':', '/');
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
TSTRING cArosPath::AsNative( const TSTRING& in )
|
||||
TSTRING cDevicePath::AsNative( const TSTRING& in )
|
||||
{
|
||||
if (in[0] != '/')
|
||||
return in;
|
||||
|
||||
int x;
|
||||
for (x=1; in[x] == '/' && x<in.length(); x++);
|
||||
#if IS_DOS_DJGPP
|
||||
if (in.find("/dev") != 0 || in.length() < 6)
|
||||
return in;
|
||||
|
||||
TSTRING out = "?:/";
|
||||
out[0] = in[5];
|
||||
|
||||
if (in.length() >= 8)
|
||||
out.append(in.substr(7));
|
||||
|
||||
return out;
|
||||
|
||||
#elif IS_AROS
|
||||
int x = 1;
|
||||
for ( x; in[x] == '/' && x<in.length(); x++);
|
||||
|
||||
TSTRING out = in.substr(x);
|
||||
TSTRING::size_type t = out.find_first_of('/');
|
||||
out[t] = ':';
|
||||
|
||||
return out;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -299,6 +299,7 @@
|
|||
#define SUPPORTS_SYSLOG (HAVE_SYSLOG_H && !IS_SKYOS)
|
||||
#define NEEDS_SWAB_IMPL (IS_SYLLABLE || IS_ANDROID || IS_SORTIX)
|
||||
#define USES_MBLEN (!IS_ANDROID && !IS_AROS)
|
||||
#define USES_DEVICE_PATH (IS_AROS || IS_DOS_DJGPP)
|
||||
#define ICONV_CONST_SOURCE (IS_MINIX)
|
||||
|
||||
|
||||
|
|
|
@ -178,13 +178,13 @@ TCHAR cUnixFSServices::GetPathSeparator() const
|
|||
return '/';
|
||||
}
|
||||
|
||||
#if !IS_AROS
|
||||
#if !USES_DEVICE_PATH
|
||||
void cUnixFSServices::ReadDir(const TSTRING& strFilename, std::vector<TSTRING> &v, bool bFullPaths) const throw(eFSServices)
|
||||
{
|
||||
#else
|
||||
void cUnixFSServices::ReadDir(const TSTRING& strFilenameC, std::vector<TSTRING>& v, bool bFullPaths) const throw(eFSServices)
|
||||
{
|
||||
TSTRING strFilename = cArosPath::AsNative(strFilenameC);
|
||||
TSTRING strFilename = cDevicePath::AsNative(strFilenameC);
|
||||
#endif
|
||||
|
||||
//Get all the filenames
|
||||
|
@ -326,13 +326,13 @@ void cUnixFSServices::SetTempDirName(TSTRING& tmpPath) {
|
|||
}
|
||||
|
||||
|
||||
#if !IS_AROS
|
||||
#if !USES_DEVICE_PATH
|
||||
void cUnixFSServices::Stat( const TSTRING& strName, cFSStatArgs &stat ) const throw(eFSServices)
|
||||
{
|
||||
#else
|
||||
void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const throw(eFSServices)
|
||||
{
|
||||
TSTRING strName = cArosPath::AsNative(strNameC);
|
||||
TSTRING strName = cDevicePath::AsNative(strNameC);
|
||||
#endif
|
||||
//local variable for obtaining info on file.
|
||||
struct stat statbuf;
|
||||
|
|
|
@ -137,8 +137,8 @@ void cFSParserUtil::InterpretFCOName( const std::list<TSTRING>& l, cFCOName& nam
|
|||
for( std::list<TSTRING>::const_iterator i = l.begin(); i != l.end(); i++ )
|
||||
strT += *i;
|
||||
|
||||
#if IS_AROS
|
||||
strT = cArosPath::AsPosix(strT);
|
||||
#if USES_DEVICE_PATH
|
||||
strT = cDevicePath::AsPosix(strT);
|
||||
#endif
|
||||
|
||||
// let cFCOName handle interpretation
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#include <sys/time.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#if !IS_SORTIX
|
||||
#if HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -311,8 +311,8 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
|
|||
// make sure it exists...
|
||||
//
|
||||
|
||||
#if IS_AROS
|
||||
temp_directory = cArosPath::AsNative(temp_directory);
|
||||
#if USES_DEVICE_PATH
|
||||
temp_directory = cDevicePath::AsNative(temp_directory);
|
||||
#endif
|
||||
|
||||
if (access(temp_directory.c_str(), F_OK) != 0) {
|
||||
|
|
Loading…
Reference in New Issue