diff --git a/src/main/java/org/truffleruby/core/support/IONodes.java b/src/main/java/org/truffleruby/core/support/IONodes.java index ec425502a6fa..6c497bee0c89 100644 --- a/src/main/java/org/truffleruby/core/support/IONodes.java +++ b/src/main/java/org/truffleruby/core/support/IONodes.java @@ -87,7 +87,6 @@ import org.truffleruby.language.control.RaiseException; import org.truffleruby.language.library.RubyStringLibrary; import org.truffleruby.language.objects.AllocationTracing; -import org.truffleruby.platform.Platform; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; @@ -153,9 +152,6 @@ boolean fnmatch(Object pattern, Object path, int flags, flags) != FNM_NOMATCH; } - - private static final boolean DOSISH = Platform.IS_WINDOWS; - private static final int FNM_NOESCAPE = 0x01; private static final int FNM_PATHNAME = 0x02; private static final int FNM_DOTMATCH = 0x04; @@ -164,7 +160,7 @@ boolean fnmatch(Object pattern, Object path, int flags, public static final int FNM_NOMATCH = 1; private static boolean isdirsep(char c) { - return c == '/' || DOSISH && c == '\\'; + return c == '/'; } private static boolean isdirsep(byte c) { @@ -259,19 +255,15 @@ private static int fnmatch_helper(byte[] bytes, int pstart, int pend, byte[] str if (s >= send) { return FNM_NOMATCH; } - if (DOSISH && (pathname && isdirsep(c) && isdirsep(string[s]))) { - } else { - if (nocase) { - if (Character.toLowerCase(c) != Character.toLowerCase((char) string[s])) { - return FNM_NOMATCH; - } - - } else { - if (c != (char) (string[s] & 0xFF)) { - return FNM_NOMATCH; - } + if (nocase) { + if (Character.toLowerCase(c) != Character.toLowerCase((char) string[s])) { + return FNM_NOMATCH; } + } else { + if (c != (char) (string[s] & 0xFF)) { + return FNM_NOMATCH; + } } s++; break; diff --git a/src/main/java/org/truffleruby/platform/Platform.java b/src/main/java/org/truffleruby/platform/Platform.java index cbf1836ce059..8104889ef5b9 100644 --- a/src/main/java/org/truffleruby/platform/Platform.java +++ b/src/main/java/org/truffleruby/platform/Platform.java @@ -35,12 +35,8 @@ public abstract class Platform extends BasicPlatform { public static final String LIB_SUFFIX = determineLibSuffix(); public static final String CEXT_SUFFIX = OS == OS_TYPE.DARWIN ? ".bundle" : LIB_SUFFIX; - public static final boolean IS_WINDOWS = OS == OS_TYPE.WINDOWS; - private static String determineLibSuffix() { switch (OS) { - case WINDOWS: - return ".dll"; case DARWIN: return ".dylib"; default: diff --git a/src/shared/java/org/truffleruby/shared/BasicPlatform.java b/src/shared/java/org/truffleruby/shared/BasicPlatform.java index af281e425fa5..a3e0ec35d7ca 100644 --- a/src/shared/java/org/truffleruby/shared/BasicPlatform.java +++ b/src/shared/java/org/truffleruby/shared/BasicPlatform.java @@ -41,9 +41,7 @@ public abstract class BasicPlatform { public enum OS_TYPE { LINUX("linux"), - DARWIN("darwin"), - SOLARIS("solaris"), - WINDOWS("mswin32"); + DARWIN("darwin"); private final String rubyName; @@ -54,8 +52,7 @@ public enum OS_TYPE { public enum ARCH { AMD64("x86_64"), - AARCH64("aarch64"), - UNKNOWN("unknown"); + AARCH64("aarch64"); private final String rubyName; @@ -79,14 +76,9 @@ public static OS_TYPE determineOS() { final String osName = System.getProperty("os.name"); final String lowerOSName = osName.toLowerCase(Locale.ENGLISH); - if (lowerOSName.contains("windows")) { - return OS_TYPE.WINDOWS; - } if (lowerOSName.startsWith("mac") || lowerOSName.startsWith("darwin")) { return OS_TYPE.DARWIN; - } else if (lowerOSName.startsWith("sunos") || lowerOSName.startsWith("solaris")) { - return OS_TYPE.SOLARIS; } final String upperOSName = osName.toUpperCase(Locale.ENGLISH); @@ -96,7 +88,7 @@ public static OS_TYPE determineOS() { } } - throw new UnsupportedOperationException("Unknown platform: " + osName); + throw new UnsupportedOperationException("Unsupported operating system: " + osName); } private static ARCH determineArchitecture() { @@ -110,7 +102,7 @@ private static ARCH determineArchitecture() { case "arm64": return ARCH.AARCH64; default: - return ARCH.UNKNOWN; + throw new UnsupportedOperationException("Unsupported CPU architecture: " + architecture); } }