[ Operating System | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

# getcwd(-Cwd)

Unifies the current working directory with Cwd.

Cwd
  String or Variable.

## Description

Cwd is unified with the current working directory including the final "/".

Equivalent to get_flag(cwd, Cwd). To set the current working directory, use set_flag(cwd, Directory) or cd(Directory).

### Modes and Determinism

- getcwd(-) is det

### Exceptions

(5) type error
  Cwd is instantiated but not to a string.

## Examples

    Success:
         [eclipse]: sh(pwd).
         /home/user/test
         yes.
         [eclipse]: getcwd(Cwd).
         Cwd = "/home/user/test/"
         yes.

    Fail:
        getcwd("nodirectory").

    Error:
          getcwd(1).           (Error 5).
          getcwd(atom).        (Error 5).

## See Also

cd / 1, get_flag / 2, set_flag / 2, mkdir / 1