1
mirror of https://github.com/mpv-player/mpv synced 2024-12-28 06:03:45 +01:00

Replace platform preprocessor check by HAVE_DOS_PATHS.

This is both more elegant and more portable.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30650 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
komh 2010-02-19 09:14:01 +00:00
parent 9216c6376a
commit 316e05b877
3 changed files with 6 additions and 6 deletions

View File

@ -147,14 +147,14 @@ static int mylstat(char *dir, char *file,struct stat* st) {
char *slash; char *slash;
l -= 3; l -= 3;
strcpy(s, dir); strcpy(s, dir);
#if defined(__MINGW32__) || defined(__CYGWIN__) #if HAVE_DOS_PATHS
if (s[l] == '/' || s[l] == '\\') if (s[l] == '/' || s[l] == '\\')
#else #else
if (s[l] == '/') if (s[l] == '/')
#endif #endif
s[l] = '\0'; s[l] = '\0';
slash = strrchr(s, '/'); slash = strrchr(s, '/');
#if defined(__MINGW32__) || defined(__CYGWIN__) #if HAVE_DOS_PATHS
if (!slash) if (!slash)
slash = strrchr(s,'\\'); slash = strrchr(s,'\\');
#endif #endif
@ -356,7 +356,7 @@ static void read_cmd(menu_t* menu,int cmd) {
if(l <= 1) break; if(l <= 1) break;
mpriv->dir[l-1] = '\0'; mpriv->dir[l-1] = '\0';
slash = strrchr(mpriv->dir,'/'); slash = strrchr(mpriv->dir,'/');
#if defined(__MINGW32__) || defined(__CYGWIN__) #if HAVE_DOS_PATHS
if (!slash) if (!slash)
slash = strrchr(mpriv->dir,'\\'); slash = strrchr(mpriv->dir,'\\');
#endif #endif
@ -456,7 +456,7 @@ static int open_fs(menu_t* menu, char* args) {
char *slash = NULL; char *slash = NULL;
if (filename && !strstr(filename, "://") && (path=realpath(filename, b))) { if (filename && !strstr(filename, "://") && (path=realpath(filename, b))) {
slash = strrchr(path, '/'); slash = strrchr(path, '/');
#if defined(__MINGW32__) || defined(__CYGWIN__) #if HAVE_DOS_PATHS
// FIXME: Do we need and can convert all '\\' in path to '/' on win32? // FIXME: Do we need and can convert all '\\' in path to '/' on win32?
if (!slash) if (!slash)
slash = strrchr(path, '\\'); slash = strrchr(path, '\\');

View File

@ -130,7 +130,7 @@ static int open_f(stream_t *stream,int mode, void* opts, int* file_format) {
return STREAM_ERROR; return STREAM_ERROR;
} }
#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) #if HAVE_DOS_PATHS
// extract '/' from '/x:/path' // extract '/' from '/x:/path'
if( filename[ 0 ] == '/' && filename[ 1 ] && filename[ 2 ] == ':' ) if( filename[ 0 ] == '/' && filename[ 1 ] && filename[ 2 ] == ':' )
filename++; filename++;

View File

@ -1856,7 +1856,7 @@ char** sub_filenames(const char* path, char *fname)
subcnt = 0; subcnt = 0;
tmp = strrchr(fname,'/'); tmp = strrchr(fname,'/');
#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) #if HAVE_DOS_PATHS
if(!tmp)tmp = strrchr(fname,'\\'); if(!tmp)tmp = strrchr(fname,'\\');
if(!tmp)tmp = strrchr(fname,':'); if(!tmp)tmp = strrchr(fname,':');
#endif #endif