private static String clearPath ( String path ) { try { ExpressionBaseState state = new ExpressionBaseState ( "EXPR" , true , false ) ; if ( Util . isWindows ( ) ) { // to not require escaping FS name separator state . setDefaultHandler ( WordCharacterHandler . IGNORE_LB_ESCAPE_OFF ) ; } else { state . setDefaultHandler ( WordCharacterHandler . IGNORE_LB_ESCAPE_ON ) ; } // Remove escaping characters path = ArgumentWithValue . resolveValue ( path , state ) ; } catch ( CommandFormatException ex ) { // XXX OK, continue translation } // Remove quote to retrieve candidates. if ( path . startsWith ( "\"" ) ) { path = path . substring ( 1 ) ; } // Could be an escaped " character. We don't take into account this corner case. // concider it the end of the quoted part. if ( path . endsWith ( "\"" ) ) { path = path . substring ( 0 , path . length ( ) - 1 ) ; } return path ; }
Unescape and unquote the path . Ready for translation .