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 );
#include "vlc_main.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 "\\"
# define PATH_SEP_CHAR ';'
......
......@@ -150,7 +150,7 @@ static int Open( vlc_object_t *p_this )
}
else psz_name = ToLocaleDup( p_access->psz_filepath );
#ifdef WIN32
#if defined( WIN32 ) || defined( __OS2__ )
if( psz_name[0] && psz_name[1] == ':' &&
psz_name[2] == '\\' && psz_name[3] == '\0' ) psz_name[2] = '\0';
#endif
......
......@@ -201,7 +201,7 @@ static int Open( vlc_object_t *p_this )
else
psz_file = strdup( p_demux->psz_file );
#ifdef WIN32
#if defined( WIN32 ) || defined( __OS2__ )
if( psz_file != NULL )
{
/* Remove trailing backslash, otherwise dvdnav_open will fail */
......
......@@ -178,7 +178,7 @@ static int Open( vlc_object_t *p_this )
else
psz_file = strdup( p_demux->psz_file );
#ifdef WIN32
#if defined( WIN32 ) || defined( __OS2__ )
if( psz_file != NULL )
{
size_t flen = strlen( psz_file );
......
......@@ -58,6 +58,8 @@
# include <io.h>
# include <ctype.h>
# include <shlwapi.h>
#elif defined( __OS2__ )
# include <ctype.h>
#else
# include <unistd.h>
#endif
......@@ -87,7 +89,7 @@ struct access_sys_t
bool b_pace_control;
};
#ifndef WIN32
#if !defined (WIN32) && !defined (__OS2__)
static bool IsRemote (int fd)
{
#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 )
int fd = p_sys->fd;
ssize_t i_ret;
#ifndef WIN32
#if !defined (WIN32) && !defined (__OS2__)
if (p_access->pf_seek == NoSeek)
i_ret = net_Read (p_access, fd, NULL, p_buffer, i_len, false);
else
......
......@@ -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] == ':' &&
psz_dup[2] == '\\' && psz_dup[3] == '\0' ) psz_dup[2] = '\0';
#endif
......
......@@ -919,7 +919,7 @@ void Execute( httpd_file_sys_t *p_args,
char *p;
char sep;
#if defined( WIN32 )
#if defined( WIN32 ) || defined( __OS2__ )
sep = '\\';
#else
sep = '/';
......
......@@ -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];
mvar_t *f;
#if defined( WIN32 )
#if defined( WIN32 ) || defined( __OS2__ )
if( psz_dir[0] == '\0' || (psz_dir[0] == '\\' && psz_dir[1] == '\0') )
{
strcpy( psz_tmp, psz_name );
......@@ -556,7 +556,7 @@ mvar_t *mvar_FileSetNew( intf_thread_t *p_intf, char *name,
mvar_AppendNewVar( f, "ext", 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') )
{
char psz_tmp[3];
......
......@@ -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 */
if( *psz_mrl == DIR_SEP_CHAR )
goto uri;
#ifdef WIN32
#if defined( WIN32 ) || defined( __OS2__ )
/* Drive letter (this assumes URL scheme are not a single character) */
if( isalpha(psz_mrl[0]) && psz_mrl[1] == ':' )
goto uri;
......
......@@ -1053,7 +1053,7 @@ void PLModel::popupExplore()
!strncasecmp( psz_access, "file", 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 \ */
if( psz_path[0] == '/' || psz_path[0] == '\\' )
psz_path++;
......
......@@ -93,7 +93,7 @@ int osd_parser_simpleOpen( vlc_object_t *p_this )
* so PATH_MAX-2 is the bigest we can have */
if( 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] != '\\' )
path[i_len] = '\\';
#else
......@@ -343,7 +343,7 @@ int osd_parser_simpleOpen( vlc_object_t *p_this )
if( result == 0 )
goto error;
msg_Dbg( p_this, " + hotkey down %s, file=%s%s",
msg_Dbg( p_this, " + hotkey down %s, file=%s%s",
action, p_menu->psz_path, file );
free( p_current->psz_action_down );
p_current->psz_action_down = strdup( action );
......
......@@ -1765,7 +1765,7 @@ static void Atmo_SetupParameters(filter_t *p_filter)
if(psz_path != NULL)
{
strcpy(p_sys->sz_framepath, psz_path);
#if defined( WIN32 )
#if defined( WIN32 ) || defined( __OS2__ )
size_t i_strlen = strlen(p_sys->sz_framepath);
if((i_strlen>0) && (p_sys->sz_framepath[i_strlen-1] != '\\'))
{
......
......@@ -1584,7 +1584,7 @@ static char *GetTmpPath( char *psz_path )
return strdup( "C:" );
}
#else
psz_path = strdup( "/tmp" );
psz_path = strdup( DIR_SEP"tmp" );
#endif
return psz_path;
......
......@@ -847,7 +847,7 @@ static const char *const ppsz_clock_descriptions[] =
#define VCD_DEV_TEXT N_("VCD device")
#define CDAUDIO_DEV_TEXT N_("Audio CD device")
#ifdef WIN32
#if defined( WIN32 ) || defined( __OS2__ )
# define DVD_DEV_LONGTEXT N_( \
"This is the default DVD drive (or file) to use. Don't forget the colon " \
"after the drive letter (e.g. D:)")
......@@ -1795,7 +1795,7 @@ vlc_module_begin ()
SUB_AUTO_TEXT, SUB_AUTO_LONGTEXT, false )
add_integer( "sub-autodetect-fuzzy", 3,
SUB_FUZZY_TEXT, SUB_FUZZY_LONGTEXT, true )
#ifdef WIN32
#if defined( WIN32 ) || defined( __OS2__ )
# define SUB_PATH ".\\subtitles"
#else
# define SUB_PATH "./Subtitles, ./subtitles"
......
......@@ -630,7 +630,7 @@ static int mrl_Parse( mrl_t *p_mrl, const char *psz_mrl )
psz_parser++;
}
}
#if defined( WIN32 ) || defined( UNDER_CE )
#if defined( WIN32 ) || defined( UNDER_CE ) || defined( __OS2__ )
if( psz_parser - psz_dup == 1 )
{
/* 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 )
*/
void filename_sanitize( char *str )
{
#if defined( WIN32 )
#if defined( WIN32 ) || defined( __OS2__ )
char *str_base = str;
#endif
......@@ -959,7 +959,7 @@ void filename_sanitize( char *str )
return;
}
#if defined( WIN32 )
#if defined( WIN32 ) || defined( __OS2__ )
// Change leading spaces into underscores
while( *str && *str == ' ' )
*str++ = '_';
......@@ -972,7 +972,7 @@ void filename_sanitize( char *str )
case '/':
#if defined( __APPLE__ )
case ':':
#elif defined( WIN32 )
#elif defined( WIN32 ) || defined( __OS2__ )
case '\\':
case '*':
case '"':
......@@ -987,7 +987,7 @@ void filename_sanitize( char *str )
str++;
}
#if defined( WIN32 )
#if defined( WIN32 ) || defined( __OS2__ )
// Change trailing spaces into underscores
str--;
while( str != str_base )
......@@ -1004,7 +1004,7 @@ void filename_sanitize( char *str )
*/
void path_sanitize( char *str )
{
#ifdef WIN32
#if defined( WIN32 ) || defined( __OS2__ )
/* check drive prefix if path is absolute */
if( (((unsigned char)(str[0] - 'A') < 26)
|| ((unsigned char)(str[0] - 'a') < 26)) && (':' == str[1]) )
......@@ -1015,7 +1015,7 @@ void path_sanitize( char *str )
#if defined( __APPLE__ )
if( *str == ':' )
*str = '_';
#elif defined( WIN32 )
#elif defined( WIN32 ) || defined( __OS2__ )
if( strchr( "*\"?:|<>", *str ) )
*str = '_';
if( *str == '/' )
......@@ -1050,7 +1050,7 @@ char *make_URI (const char *path, const char *scheme)
* scheme name (such as mailto: or news:). */
char *buf;
#ifdef WIN32
#if defined( WIN32 ) || defined( __OS2__ )
/* Drive letter */
if (isalpha (path[0]) && (path[1] == ':'))
{
......@@ -1066,7 +1066,7 @@ char *make_URI (const char *path, const char *scheme)
#endif
if (!strncmp (path, "\\\\", 2))
{ /* Windows UNC paths */
#ifndef WIN32
#if !defined( WIN32 ) && !defined( __OS2__ )
if (scheme != NULL)
return NULL; /* remote files not supported */
......@@ -1183,7 +1183,7 @@ char *make_path (const char *url)
#endif
/* Leading slash => local path */
if (*path == DIR_SEP_CHAR)
#if !defined (WIN32) || defined (UNDER_CE)
#if (!defined (WIN32) && !defined (__OS2__)) || defined (UNDER_CE)
return path;
#else
return memmove (path, path + 1, strlen (path + 1) + 1);
......@@ -1193,7 +1193,7 @@ char *make_path (const char *url)
if (!strncasecmp (path, "localhost"DIR_SEP, 10))
return memmove (path, path + 9, strlen (path + 9) + 1);
#ifdef WIN32
#if defined( WIN32 ) || defined( __OS2__ )
if (*path && asprintf (&ret, "\\\\%s", path) == -1)
ret = NULL;
#endif
......@@ -1207,7 +1207,7 @@ char *make_path (const char *url)
if (*end)
goto out;
#ifndef WIN32
#if !defined( WIN32 ) && !defined( __OS2__ )
switch (fd)
{
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