1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/documentation/docs/scripts/fileUtils.md
Oliver Feldmann 8e70c72ea9 Documentation improvements
Slight improvements on various md files.
Deletion of method-based commonPipelineEnvironment documentation as it
is not used.
2017-12-06 13:24:01 +01:00

1.5 KiB

FileUtils

Description

Provides file system related utility functions.

Constructor

Since there are only static utility methods there is no need for instantiating objects.

Method Details

validateDirectory(dir)

Description

Checks whether a file exists and is a directory.

Parameters

  • dir - The directory to be checked. In case it is relative path it is checked against the current working directory. In case of doubt use the absolute path (prefix the directory with pwd).

Return value

none

Side effects

none

Exceptions

  • IllegalArgumentException:
    • If the parameter dir is null or empty.
  • AbortException:
    • If the directory does not exist or is not a directory.

Example

FileUtils.validateDirectory('/path/to/dir')

validateDirectoryIsNotEmpty(dir)

Description

Check whether a directory is not empty. Before the directory is checked, validateDirectory(dir) is executed.

Parameters

  • dir - The directory to be checked. In case it is relative path it is checked against the current working directory. In case of doubt use the absolute path (prefix the directory with pwd).

Return value

none

Side effects

none

Exceptions

  • IllegalArgumentException:
    • If the parameter dir is null or empty.
  • AbortException:
    • If the directory does not exist or is not a directory or the directory is empty.

Example

FileUtils.validateDirectoryIsNotEmpty('/path/to/dir')