Commit 397919b4 authored by KO Myung-Hun's avatar KO Myung-Hun Committed by Rémi Duraffort

OS/2 uses the same path style as Win32.

Drive letters, backslashes instead of slashes, and so on.
Signed-off-by: default avatarRémi Duraffort <ivoire@videolan.org>
parent 3a470a07
...@@ -891,7 +891,7 @@ VLC_EXPORT( const char *, VLC_Compiler, ( void ) LIBVLC_USED ); ...@@ -891,7 +891,7 @@ VLC_EXPORT( const char *, VLC_Compiler, ( void ) LIBVLC_USED );
#include "vlc_main.h" #include "vlc_main.h"
#include "vlc_configuration.h" #include "vlc_configuration.h"
#if defined( WIN32 ) || defined( UNDER_CE ) || defined( __SYMBIAN32__ ) #if defined( WIN32 ) || defined( UNDER_CE ) || defined( __SYMBIAN32__ ) || defined( __OS2__ )
# define DIR_SEP_CHAR '\\' # define DIR_SEP_CHAR '\\'
# define DIR_SEP "\\" # define DIR_SEP "\\"
# define PATH_SEP_CHAR ';' # define PATH_SEP_CHAR ';'
......
...@@ -150,7 +150,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -150,7 +150,7 @@ static int Open( vlc_object_t *p_this )
} }
else psz_name = ToLocaleDup( p_access->psz_filepath ); else psz_name = ToLocaleDup( p_access->psz_filepath );
#ifdef WIN32 #if defined( WIN32 ) || defined( __OS2__ )
if( psz_name[0] && psz_name[1] == ':' && if( psz_name[0] && psz_name[1] == ':' &&
psz_name[2] == '\\' && psz_name[3] == '\0' ) psz_name[2] = '\0'; psz_name[2] == '\\' && psz_name[3] == '\0' ) psz_name[2] = '\0';
#endif #endif
......
...@@ -201,7 +201,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -201,7 +201,7 @@ static int Open( vlc_object_t *p_this )
else else
psz_file = strdup( p_demux->psz_file ); psz_file = strdup( p_demux->psz_file );
#ifdef WIN32 #if defined( WIN32 ) || defined( __OS2__ )
if( psz_file != NULL ) if( psz_file != NULL )
{ {
/* Remove trailing backslash, otherwise dvdnav_open will fail */ /* Remove trailing backslash, otherwise dvdnav_open will fail */
......
...@@ -178,7 +178,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -178,7 +178,7 @@ static int Open( vlc_object_t *p_this )
else else
psz_file = strdup( p_demux->psz_file ); psz_file = strdup( p_demux->psz_file );
#ifdef WIN32 #if defined( WIN32 ) || defined( __OS2__ )
if( psz_file != NULL ) if( psz_file != NULL )
{ {
size_t flen = strlen( psz_file ); size_t flen = strlen( psz_file );
......
...@@ -58,6 +58,8 @@ ...@@ -58,6 +58,8 @@
# include <io.h> # include <io.h>
# include <ctype.h> # include <ctype.h>
# include <shlwapi.h> # include <shlwapi.h>
#elif defined( __OS2__ )
# include <ctype.h>
#else #else
# include <unistd.h> # include <unistd.h>
#endif #endif
...@@ -87,7 +89,7 @@ struct access_sys_t ...@@ -87,7 +89,7 @@ struct access_sys_t
bool b_pace_control; bool b_pace_control;
}; };
#ifndef WIN32 #if !defined (WIN32) && !defined (__OS2__)
static bool IsRemote (int fd) static bool IsRemote (int fd)
{ {
#if defined (HAVE_FSTATVFS) && defined (MNT_LOCAL) #if defined (HAVE_FSTATVFS) && defined (MNT_LOCAL)
...@@ -284,7 +286,7 @@ ssize_t FileRead( access_t *p_access, uint8_t *p_buffer, size_t i_len ) ...@@ -284,7 +286,7 @@ ssize_t FileRead( access_t *p_access, uint8_t *p_buffer, size_t i_len )
int fd = p_sys->fd; int fd = p_sys->fd;
ssize_t i_ret; ssize_t i_ret;
#ifndef WIN32 #if !defined (WIN32) && !defined (__OS2__)
if (p_access->pf_seek == NoSeek) if (p_access->pf_seek == NoSeek)
i_ret = net_Read (p_access, fd, NULL, p_buffer, i_len, false); i_ret = net_Read (p_access, fd, NULL, p_buffer, i_len, false);
else else
......
...@@ -132,7 +132,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -132,7 +132,7 @@ static int Open( vlc_object_t *p_this )
} }
} }
#ifdef WIN32 #if defined( WIN32 ) || defined( __OS2__ )
if( psz_dup[0] && psz_dup[1] == ':' && if( psz_dup[0] && psz_dup[1] == ':' &&
psz_dup[2] == '\\' && psz_dup[3] == '\0' ) psz_dup[2] = '\0'; psz_dup[2] == '\\' && psz_dup[3] == '\0' ) psz_dup[2] = '\0';
#endif #endif
......
...@@ -919,7 +919,7 @@ void Execute( httpd_file_sys_t *p_args, ...@@ -919,7 +919,7 @@ void Execute( httpd_file_sys_t *p_args,
char *p; char *p;
char sep; char sep;
#if defined( WIN32 ) #if defined( WIN32 ) || defined( __OS2__ )
sep = '\\'; sep = '\\';
#else #else
sep = '/'; sep = '/';
......
...@@ -527,7 +527,7 @@ mvar_t *mvar_FileSetNew( intf_thread_t *p_intf, char *name, ...@@ -527,7 +527,7 @@ mvar_t *mvar_FileSetNew( intf_thread_t *p_intf, char *name,
char psz_tmp[strlen( psz_dir ) + 1 + strlen( psz_name ) + 1]; char psz_tmp[strlen( psz_dir ) + 1 + strlen( psz_name ) + 1];
mvar_t *f; mvar_t *f;
#if defined( WIN32 ) #if defined( WIN32 ) || defined( __OS2__ )
if( psz_dir[0] == '\0' || (psz_dir[0] == '\\' && psz_dir[1] == '\0') ) if( psz_dir[0] == '\0' || (psz_dir[0] == '\\' && psz_dir[1] == '\0') )
{ {
strcpy( psz_tmp, psz_name ); strcpy( psz_tmp, psz_name );
...@@ -556,7 +556,7 @@ mvar_t *mvar_FileSetNew( intf_thread_t *p_intf, char *name, ...@@ -556,7 +556,7 @@ mvar_t *mvar_FileSetNew( intf_thread_t *p_intf, char *name,
mvar_AppendNewVar( f, "ext", psz_ext ); mvar_AppendNewVar( f, "ext", psz_ext );
free( psz_ext ); free( psz_ext );
#if defined( WIN32 ) #if defined( WIN32 ) || defined( __OS2__ )
if( psz_dir[0] == '\0' || (psz_dir[0] == '\\' && psz_dir[1] == '\0') ) if( psz_dir[0] == '\0' || (psz_dir[0] == '\\' && psz_dir[1] == '\0') )
{ {
char psz_tmp[3]; char psz_tmp[3];
......
...@@ -203,7 +203,7 @@ char *ProcessMRL( const char *psz_mrl, const char *psz_prefix ) ...@@ -203,7 +203,7 @@ char *ProcessMRL( const char *psz_mrl, const char *psz_prefix )
/* FIXME: that's wrong if the playlist is not a local file */ /* FIXME: that's wrong if the playlist is not a local file */
if( *psz_mrl == DIR_SEP_CHAR ) if( *psz_mrl == DIR_SEP_CHAR )
goto uri; goto uri;
#ifdef WIN32 #if defined( WIN32 ) || defined( __OS2__ )
/* Drive letter (this assumes URL scheme are not a single character) */ /* Drive letter (this assumes URL scheme are not a single character) */
if( isalpha(psz_mrl[0]) && psz_mrl[1] == ':' ) if( isalpha(psz_mrl[0]) && psz_mrl[1] == ':' )
goto uri; goto uri;
......
...@@ -1053,7 +1053,7 @@ void PLModel::popupExplore() ...@@ -1053,7 +1053,7 @@ void PLModel::popupExplore()
!strncasecmp( psz_access, "file", 4 ) || !strncasecmp( psz_access, "file", 4 ) ||
!strncasecmp( psz_access, "dire", 4 ) )) !strncasecmp( psz_access, "dire", 4 ) ))
{ {
#ifdef WIN32 #if defined( WIN32 ) || defined( __OS2__ )
/* Qt openURL doesn't know to open files that starts with a / or \ */ /* Qt openURL doesn't know to open files that starts with a / or \ */
if( psz_path[0] == '/' || psz_path[0] == '\\' ) if( psz_path[0] == '/' || psz_path[0] == '\\' )
psz_path++; psz_path++;
......
...@@ -93,7 +93,7 @@ int osd_parser_simpleOpen( vlc_object_t *p_this ) ...@@ -93,7 +93,7 @@ int osd_parser_simpleOpen( vlc_object_t *p_this )
* so PATH_MAX-2 is the bigest we can have */ * so PATH_MAX-2 is the bigest we can have */
if( i_len > PATH_MAX - 2 ) if( i_len > PATH_MAX - 2 )
i_len = PATH_MAX - 2; i_len = PATH_MAX - 2;
#if defined(WIN32) || defined(UNDER_CE) #if defined(WIN32) || defined(UNDER_CE) || defined(__OS2__)
if( (i_len > 0) && path[i_len] != '\\' ) if( (i_len > 0) && path[i_len] != '\\' )
path[i_len] = '\\'; path[i_len] = '\\';
#else #else
......
...@@ -1765,7 +1765,7 @@ static void Atmo_SetupParameters(filter_t *p_filter) ...@@ -1765,7 +1765,7 @@ static void Atmo_SetupParameters(filter_t *p_filter)
if(psz_path != NULL) if(psz_path != NULL)
{ {
strcpy(p_sys->sz_framepath, psz_path); strcpy(p_sys->sz_framepath, psz_path);
#if defined( WIN32 ) #if defined( WIN32 ) || defined( __OS2__ )
size_t i_strlen = strlen(p_sys->sz_framepath); size_t i_strlen = strlen(p_sys->sz_framepath);
if((i_strlen>0) && (p_sys->sz_framepath[i_strlen-1] != '\\')) if((i_strlen>0) && (p_sys->sz_framepath[i_strlen-1] != '\\'))
{ {
......
...@@ -1584,7 +1584,7 @@ static char *GetTmpPath( char *psz_path ) ...@@ -1584,7 +1584,7 @@ static char *GetTmpPath( char *psz_path )
return strdup( "C:" ); return strdup( "C:" );
} }
#else #else
psz_path = strdup( "/tmp" ); psz_path = strdup( DIR_SEP"tmp" );
#endif #endif
return psz_path; return psz_path;
......
...@@ -847,7 +847,7 @@ static const char *const ppsz_clock_descriptions[] = ...@@ -847,7 +847,7 @@ static const char *const ppsz_clock_descriptions[] =
#define VCD_DEV_TEXT N_("VCD device") #define VCD_DEV_TEXT N_("VCD device")
#define CDAUDIO_DEV_TEXT N_("Audio CD device") #define CDAUDIO_DEV_TEXT N_("Audio CD device")
#ifdef WIN32 #if defined( WIN32 ) || defined( __OS2__ )
# define DVD_DEV_LONGTEXT N_( \ # define DVD_DEV_LONGTEXT N_( \
"This is the default DVD drive (or file) to use. Don't forget the colon " \ "This is the default DVD drive (or file) to use. Don't forget the colon " \
"after the drive letter (e.g. D:)") "after the drive letter (e.g. D:)")
...@@ -1795,7 +1795,7 @@ vlc_module_begin () ...@@ -1795,7 +1795,7 @@ vlc_module_begin ()
SUB_AUTO_TEXT, SUB_AUTO_LONGTEXT, false ) SUB_AUTO_TEXT, SUB_AUTO_LONGTEXT, false )
add_integer( "sub-autodetect-fuzzy", 3, add_integer( "sub-autodetect-fuzzy", 3,
SUB_FUZZY_TEXT, SUB_FUZZY_LONGTEXT, true ) SUB_FUZZY_TEXT, SUB_FUZZY_LONGTEXT, true )
#ifdef WIN32 #if defined( WIN32 ) || defined( __OS2__ )
# define SUB_PATH ".\\subtitles" # define SUB_PATH ".\\subtitles"
#else #else
# define SUB_PATH "./Subtitles, ./subtitles" # define SUB_PATH "./Subtitles, ./subtitles"
......
...@@ -630,7 +630,7 @@ static int mrl_Parse( mrl_t *p_mrl, const char *psz_mrl ) ...@@ -630,7 +630,7 @@ static int mrl_Parse( mrl_t *p_mrl, const char *psz_mrl )
psz_parser++; psz_parser++;
} }
} }
#if defined( WIN32 ) || defined( UNDER_CE ) #if defined( WIN32 ) || defined( UNDER_CE ) || defined( __OS2__ )
if( psz_parser - psz_dup == 1 ) if( psz_parser - psz_dup == 1 )
{ {
/* msg_Warn( p_sout, "drive letter %c: found in source string", /* msg_Warn( p_sout, "drive letter %c: found in source string",
......
...@@ -945,7 +945,7 @@ char *str_format( vlc_object_t *p_this, const char *psz_src ) ...@@ -945,7 +945,7 @@ char *str_format( vlc_object_t *p_this, const char *psz_src )
*/ */
void filename_sanitize( char *str ) void filename_sanitize( char *str )
{ {
#if defined( WIN32 ) #if defined( WIN32 ) || defined( __OS2__ )
char *str_base = str; char *str_base = str;
#endif #endif
...@@ -959,7 +959,7 @@ void filename_sanitize( char *str ) ...@@ -959,7 +959,7 @@ void filename_sanitize( char *str )
return; return;
} }
#if defined( WIN32 ) #if defined( WIN32 ) || defined( __OS2__ )
// Change leading spaces into underscores // Change leading spaces into underscores
while( *str && *str == ' ' ) while( *str && *str == ' ' )
*str++ = '_'; *str++ = '_';
...@@ -972,7 +972,7 @@ void filename_sanitize( char *str ) ...@@ -972,7 +972,7 @@ void filename_sanitize( char *str )
case '/': case '/':
#if defined( __APPLE__ ) #if defined( __APPLE__ )
case ':': case ':':
#elif defined( WIN32 ) #elif defined( WIN32 ) || defined( __OS2__ )
case '\\': case '\\':
case '*': case '*':
case '"': case '"':
...@@ -987,7 +987,7 @@ void filename_sanitize( char *str ) ...@@ -987,7 +987,7 @@ void filename_sanitize( char *str )
str++; str++;
} }
#if defined( WIN32 ) #if defined( WIN32 ) || defined( __OS2__ )
// Change trailing spaces into underscores // Change trailing spaces into underscores
str--; str--;
while( str != str_base ) while( str != str_base )
...@@ -1004,7 +1004,7 @@ void filename_sanitize( char *str ) ...@@ -1004,7 +1004,7 @@ void filename_sanitize( char *str )
*/ */
void path_sanitize( char *str ) void path_sanitize( char *str )
{ {
#ifdef WIN32 #if defined( WIN32 ) || defined( __OS2__ )
/* check drive prefix if path is absolute */ /* check drive prefix if path is absolute */
if( (((unsigned char)(str[0] - 'A') < 26) if( (((unsigned char)(str[0] - 'A') < 26)
|| ((unsigned char)(str[0] - 'a') < 26)) && (':' == str[1]) ) || ((unsigned char)(str[0] - 'a') < 26)) && (':' == str[1]) )
...@@ -1015,7 +1015,7 @@ void path_sanitize( char *str ) ...@@ -1015,7 +1015,7 @@ void path_sanitize( char *str )
#if defined( __APPLE__ ) #if defined( __APPLE__ )
if( *str == ':' ) if( *str == ':' )
*str = '_'; *str = '_';
#elif defined( WIN32 ) #elif defined( WIN32 ) || defined( __OS2__ )
if( strchr( "*\"?:|<>", *str ) ) if( strchr( "*\"?:|<>", *str ) )
*str = '_'; *str = '_';
if( *str == '/' ) if( *str == '/' )
...@@ -1050,7 +1050,7 @@ char *make_URI (const char *path, const char *scheme) ...@@ -1050,7 +1050,7 @@ char *make_URI (const char *path, const char *scheme)
* scheme name (such as mailto: or news:). */ * scheme name (such as mailto: or news:). */
char *buf; char *buf;
#ifdef WIN32 #if defined( WIN32 ) || defined( __OS2__ )
/* Drive letter */ /* Drive letter */
if (isalpha (path[0]) && (path[1] == ':')) if (isalpha (path[0]) && (path[1] == ':'))
{ {
...@@ -1066,7 +1066,7 @@ char *make_URI (const char *path, const char *scheme) ...@@ -1066,7 +1066,7 @@ char *make_URI (const char *path, const char *scheme)
#endif #endif
if (!strncmp (path, "\\\\", 2)) if (!strncmp (path, "\\\\", 2))
{ /* Windows UNC paths */ { /* Windows UNC paths */
#ifndef WIN32 #if !defined( WIN32 ) && !defined( __OS2__ )
if (scheme != NULL) if (scheme != NULL)
return NULL; /* remote files not supported */ return NULL; /* remote files not supported */
...@@ -1183,7 +1183,7 @@ char *make_path (const char *url) ...@@ -1183,7 +1183,7 @@ char *make_path (const char *url)
#endif #endif
/* Leading slash => local path */ /* Leading slash => local path */
if (*path == DIR_SEP_CHAR) if (*path == DIR_SEP_CHAR)
#if !defined (WIN32) || defined (UNDER_CE) #if (!defined (WIN32) && !defined (__OS2__)) || defined (UNDER_CE)
return path; return path;
#else #else
return memmove (path, path + 1, strlen (path + 1) + 1); return memmove (path, path + 1, strlen (path + 1) + 1);
...@@ -1193,7 +1193,7 @@ char *make_path (const char *url) ...@@ -1193,7 +1193,7 @@ char *make_path (const char *url)
if (!strncasecmp (path, "localhost"DIR_SEP, 10)) if (!strncasecmp (path, "localhost"DIR_SEP, 10))
return memmove (path, path + 9, strlen (path + 9) + 1); return memmove (path, path + 9, strlen (path + 9) + 1);
#ifdef WIN32 #if defined( WIN32 ) || defined( __OS2__ )
if (*path && asprintf (&ret, "\\\\%s", path) == -1) if (*path && asprintf (&ret, "\\\\%s", path) == -1)
ret = NULL; ret = NULL;
#endif #endif
...@@ -1207,7 +1207,7 @@ char *make_path (const char *url) ...@@ -1207,7 +1207,7 @@ char *make_path (const char *url)
if (*end) if (*end)
goto out; goto out;
#ifndef WIN32 #if !defined( WIN32 ) && !defined( __OS2__ )
switch (fd) switch (fd)
{ {
case 0: case 0:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment