Prototype: translatepath(path)

Return type: string

Description: Translate separators in path from Unix style to the host's native style and returns the result.

Takes a string argument with slashes as path separators and translate these to the native format for path separators on the host. For example translatepath("a/b/c") would yield "a/b/c" on Unix platforms, but "a\b\c" on Windows.


  • path: string, in the range: "?(/.*)


body common control
      bundlesequence => { "test" };

bundle agent test
      "inputs_dir" string => translatepath("/a/b/c/inputs");


      "The path has backslashes: $(inputs_dir)";

      "The path has slashes: $(inputs_dir)";


R: The path has slashes: /a/b/c/inputs

Notes: Be careful when using this function in combination with regular expressions, since backslash is also used as escape character in regex's. For example, in the regex dir/.abc, the dot represents the regular expression "any character", while in the regex dir\.abc, the backslash-dot represents a literal dot character.