/*
 * SDK Pullenti Unitext, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved. 
 * Non-Commercial Freeware and Commercial Software. 
 * This class is generated using the converter Unisharping (www.unisharping.ru) from Pullenti C# project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */

package com.pullenti.unitext.internal.zip;

// WindowsPathUtils provides simple utilities for handling windows paths.
public abstract class WindowsPathUtils {

    public WindowsPathUtils() {
    }

    public static String dropPathRoot(String path) {
        String result = path;
        if ((path != null) && (path.length() > 0)) {
            if ((path.charAt(0) == '\\') || (path.charAt(0) == '/')) {
                if ((path.length() > 1) && (((path.charAt(1) == '\\') || (path.charAt(1) == '/')))) {
                    int index = 2;
                    int elements = 2;
                    while ((index <= path.length()) && (((((path.charAt(index) != '\\') && (path.charAt(index) != '/'))) || ((--elements) > 0)))) {
                        index++;
                    }
                    index++;
                    if (index < path.length()) 
                        result = path.substring(index);
                    else 
                        result = "";
                }
            }
            else if ((path.length() > 1) && (path.charAt(1) == ':')) {
                int dropCount = 2;
                if ((path.length() > 2) && (((path.charAt(2) == '\\') || (path.charAt(2) == '/')))) 
                    dropCount = 3;
                result = result.substring(dropCount);
            }
        }
        return result;
    }
}
