• 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
  • pathseparator

    Prev Next
    Macro
    Get the operating system's path separator character

    Summary

    The pathseparator macro returns the operating system’s path separator character used to separate entries in path lists like classpaths.

    Syntax

    ${pathseparator}
    

    Parameters

    None - this macro takes no parameters.

    Behavior

    • Returns : (colon) on Unix/Linux/Mac systems
    • Returns ; (semicolon) on Windows systems
    • Returns the value of File.pathSeparator in Java

    Examples

    Get the path separator:

    ${pathseparator}
    # Returns: ":" on Unix, ";" on Windows
    

    Build a path manually:

    classpath=lib/a.jar${pathseparator}lib/b.jar${pathseparator}lib/c.jar
    

    Use in conditionals:

    ${if;${equals;${pathseparator};:};unix;windows}
    

    Split paths:

    ${split;${pathseparator};${some.path}}
    

    Use Cases

    • Determining the platform at build time
    • Manual path construction
    • Splitting path strings
    • Platform-specific logic
    • Cross-platform path handling
    • Tool configuration

    Notes

    • Returns a single character: : or ;
    • This is different from the file separator (/ or \)
    • Used for separating multiple paths (like in CLASSPATH)
    • See also: ${separator} for the file separator
    • See also: ${path} which automatically uses the correct separator
    • The path separator is determined by the OS running the build

    See test cases in MacroTestsForDocsExamples.java

Prev Next
Search
    • Home