@@ -0,0 +1,1522 @@
+// SPDX-License-Identifier: MIT%0A// Copyright (C) 2018-present iced project and contributors%0A%0Apackage com.github.icedland.iced.x86;%0A%0Aimport java.nio.file.Path;%0Aimport java.nio.file.Paths;%0Aimport java.util.ArrayList;%0Aimport java.util.Arrays;%0A%0Apublic final class PathUtils %7B%0A%09private static Path rootDir = getIcedRootDir();%0A%0A%09private static Path getIcedRootDir() %7B%0A%09%09final String ENV_ROOT_NAME = %22ICED_REPO_ROOT_DIR%22;%0A%09%09String envRootDir = System.getenv(ENV_ROOT_NAME);%0A%09%09Path rootDir = null;%0A%09%09if (envRootDir != null)%0A%09%09%09rootDir = Paths.get(envRootDir).toAbsolutePath();%0A%09%09else %7B%0A%09%09%09// This code assumes the dir is %22%3Crepo-root%3E/src/java/iced-x86%22%0A%09%09%09String userDir = System.getProperty(%22user.dir%22);%0A%09%09%09if (userDir != null) %7B%0A%09%09%09%09Path path = Paths.get(userDir);%0A%09%09%09%09rootDir = path.toAbsolutePath().getParent().getParent().getParent();%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09if (rootDir != null && rootDir.resolve(%22LICENSE.txt%22).toFile().exists())%0A%09%09%09return rootDir;%0A%0A%09%09throw new UnsupportedOperationException(String.format(%22Couldn't find the iced repo root dir. Try setting %25s env var to the root of the repo%22, ENV_ROOT_NAME));%0A%09%7D%0A%0A%09public static String getTestTextFilename(String... items) %7B%0A%09%09ArrayList%3CString%3E dirs = new ArrayList%3CString%3E();%0A%09%09dirs.addAll(Arrays.asList(%22src%22, %22UnitTests%22, %22Intel%22));%0A%09%09dirs.addAll(Arrays.asList(items));%0A%09%09Path path = Paths.get(rootDir.toString(), dirs.toArray(new String%5Bdirs.size()%5D));%0A%09%09String result = path.toAbsolutePath().normalize().toString();%0A%09%09System.out.println(%22path: %22 + result);%0A%09%09return result;%0A%09%7D%0A%7D%0A

Add `PathUtils`