commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject svn commit: r417086 - /jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java
Date Sun, 25 Jun 2006 22:40:19 GMT
Author: scolebourne
Date: Sun Jun 25 15:40:18 2006
New Revision: 417086

URL: http://svn.apache.org/viewvc?rev=417086&view=rev
Log:
Refactor windows identification to a method

Modified:
    jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java

Modified: jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java?rev=417086&r1=417085&r2=417086&view=diff
==============================================================================
--- jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java (original)
+++ jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java Sun
Jun 25 15:40:18 2006
@@ -116,7 +116,7 @@
      */
     private static final char OTHER_SEPARATOR;
     static {
-        if (SYSTEM_SEPARATOR == WINDOWS_SEPARATOR) {
+        if (isSystemWindows()) {
             OTHER_SEPARATOR = UNIX_SEPARATOR;
         } else {
             OTHER_SEPARATOR = WINDOWS_SEPARATOR;
@@ -132,6 +132,16 @@
 
     //-----------------------------------------------------------------------
     /**
+     * Determines if Windows file system is in use.
+     * 
+     * @return true if the system is Windows
+     */
+    static boolean isSystemWindows() {
+        return SYSTEM_SEPARATOR == WINDOWS_SEPARATOR;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Checks if the character is a separator.
      * 
      * @param ch  the character to check
@@ -432,7 +442,7 @@
         if (path == null) {
             return null;
         }
-        if (SYSTEM_SEPARATOR == WINDOWS_SEPARATOR) {
+        if (isSystemWindows()) {
             return separatorsToWindows(path);
         } else {
             return separatorsToUnix(path);
@@ -966,7 +976,7 @@
             filename1 = normalize(filename1);
             filename2 = normalize(filename2);
         }
-        if (system && (SYSTEM_SEPARATOR == WINDOWS_SEPARATOR)) {
+        if (system && isSystemWindows()) {
             return filename1.equalsIgnoreCase(filename2);
         } else {
             return filename1.equals(filename2);
@@ -1117,7 +1127,7 @@
         if (filename == null || wildcardMatcher == null) {
             return false;
         }
-        if (system && (SYSTEM_SEPARATOR == WINDOWS_SEPARATOR)) {
+        if (system && isSystemWindows()) {
             filename = filename.toLowerCase();
             wildcardMatcher = wildcardMatcher.toLowerCase();
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message