• Intro Headers Instructions Macros Commands
Fork me on GitHub
    • Getting Started
      • Introduction
      • How to install bnd
      • Guided Tour Workspace & Projects
      • bnd / bndlib Features and JAR Wrapping Techniques
      • FAQ - Frequently Asked Questions
    • Concepts and Practices
      • Concepts
      • Background
      • Best practices
    • Build and Development
      • Build
      • Generating JARs
      • Versioning
      • Baselining
      • Service Components
      • Metatype
      • Contracts
      • Bundle Annotations
      • Accessor Properties
      • SPI Annotations
    • Dependency and Launching
      • Resolving Dependencies
      • Launching
      • Startlevels
    • Testing
      • Testing
      • Testing with Launchpad
    • Packaging and Distribution
      • Packaging Applications
      • JPMS Libraries
      • Wrapping Libraries to OSGi Bundles
    • Documentation and Tools
      • Generating Documentation
      • bnd CLI Commands
      • For Developers
      • Templates for Workspaces
      • Tips for Windows users
      • Tools bound to bnd
    • Reference Material
      • Reference
      • Headers
      • Instruction Reference
      • Instruction Index
      • Macro Reference
      • Macro Index
      • Plugins
      • External Plugins
    • Configuration and Troubleshooting
      • Settings
      • Errors
      • Warnings
  • isfile (';' FILE )+

    Prev Next
    Macro
    Check if all specified paths are regular files

    Summary

    The isfile macro checks whether all specified file paths are regular files (not directories or special files). It returns “true” only if all paths exist and are regular files; otherwise, it returns “false”.

    Syntax

    ${isfile;<path>[;<path>...]}
    

    Parameters

    • path - One or more file paths to check (can be absolute or relative)

    Behavior

    • Converts each path to an absolute path
    • Checks if each path exists and is a regular file
    • Returns “true” only if ALL paths are regular files
    • Returns “false” if any path is not a file, is a directory, or doesn’t exist
    • Issues a warning if no paths are provided

    Examples

    Check a single file:

    ${isfile;build.gradle}
    # Returns: "true" if build.gradle exists and is a file
    

    Check multiple files:

    ${isfile;pom.xml;build.gradle;settings.gradle}
    # Returns: "true" only if all three are files
    

    Use in conditional logic:

    ${if;${isfile;custom.bnd};${cat;custom.bnd};default-settings}
    

    Validate required files:

    ${if;${isfile;LICENSE;README.md};files-present;${error;Missing required files}}
    

    Check file existence before processing:

    config=${if;${isfile;config.properties};${cat;config.properties};{}}
    

    Use Cases

    • Validating that required files exist
    • Conditional logic based on file presence
    • Build prerequisite checking
    • File existence verification before reading
    • Distinguishing between files and directories
    • Checking multiple file dependencies

    Notes

    • Returns “false” (not error) if paths don’t exist
    • All paths must be regular files for “true” result
    • Returns string “true” or “false”, not boolean
    • Paths are resolved to absolute paths before checking
    • Directories, symbolic links, and special files return “false”
    • See also: ${isdir} for checking if paths are directories
    • Useful with ${if} macro for conditional behavior
    • Generates a warning if called without arguments

    See test cases in MacroTestsForDocsExamples.java

Prev Next
Search
    • Home