Do I have a way to check the existence of a directory in Ant (not a file)?

前端 未结 6 1776
离开以前
离开以前 2020-12-04 15:10

How do I check for the existence of a folder using Ant?

We can check the existence of a file, but can we do the same for a folder as well?

6条回答
  •  离开以前
    2020-12-04 15:57

    My solution using ANT 1.8 version, older versions may not work due if/unless not supporting ${evalTrueOrFalse} syntax.

    
    
    
    
    
    
    
    
    
      
    
    
    
      
    
    
    
      
    
      
      
      
      
    
    
    
    
    • ANT 1.6 or early ANT 1.7 does not work, upgrade to ANT 1.8 release.
    • Target attributes if and unless evaluates ${var} syntax to true/false
    • Condition attribute else value is set to property if available condition was false, without it variable is not set. NotSet value is not same as an explicit false value.
    • call any target but if/unless attribute defines whether its actually run

    http://ant.apache.org/manual/properties.html#if+unless
    [If/Unless] In Ant 1.7.1 and earlier, these attributes could only be property names. As of Ant 1.8.0, you may instead use property expansion. Compared to the older style, this gives you additional flexibility.

提交回复
热议问题