String (@NotNull String path) { if (!path.startsWith("./") && !path.startsWith("../")) return null; int index = 0; char currentChar = path.charAt(index); while (currentChar == '.' || currentChar == '/') { index++; if (index >= path.length()) break; currentChar = path.charAt(index); } return path.substring(0, index); }