UserInterface/Path_Convert_Win32_to_Unix [ Functions ]

FUNCTION

Although people are supposed to specify all paths with a '/' as seperator, sometimes people on Win32 use '\', this causes problems later on in some other function of robodoc that expect a '/'. So to prevent this we replace all the '\' in a path with '/'

    

In addition people sometimes add a '/' at the end of the path. We remove it.

SYNOPSIS

static char        *Path_Convert_Win32_to_Unix(
    char *path )

INPUTS

RESULT

SOURCE

{
    size_t              i;

    /* First make a copy */
    path = RB_StrDup( path );
    for ( i = 0; i < strlen( path ); ++i )
    {
        if ( path[i] == '\\' )
        {
            path[i] = '/';
        }
    }

    /* Remove trailing '/' if there is one. */
    if ( path[strlen( path ) - 1] == '/' )
    {
        path[strlen( path ) - 1] = '\0';
    }

    return path;
}