Code/net/minecraft/util/FileSystemUtil.java

32 lines
1017 B
Java
Raw Normal View History

2025-07-01 06:20:03 +00:00
package net.minecraft.util;
import com.mojang.logging.LogUtils;
import java.io.IOException;
import java.net.URI;
import java.nio.file.FileSystemAlreadyExistsException;
import java.nio.file.FileSystemNotFoundException;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collections;
import org.slf4j.Logger;
public class FileSystemUtil {
private static final Logger LOGGER = LogUtils.getLogger();
public static Path safeGetPath(URI p_396304_) throws IOException {
try {
return Paths.get(p_396304_);
} catch (FileSystemNotFoundException filesystemnotfoundexception) {
} catch (Throwable throwable) {
LOGGER.warn("Unable to get path for: {}", p_396304_, throwable);
}
try {
FileSystems.newFileSystem(p_396304_, Collections.emptyMap());
} catch (FileSystemAlreadyExistsException filesystemalreadyexistsexception) {
}
return Paths.get(p_396304_);
}
}