%% %CopyrightBegin%
%%
%% SPDX-License-Identifier: Apache-2.0
%%
%% Copyright Ericsson AB 2021-2025. All Rights Reserved.
%%
%% %CopyrightEnd%

[;1m  set_cwd(Dir)[0m

  Sets the current working directory of the file server to [;;4mDir[0m.
  Returns [;;4mok[0m if successful.

  The functions in the module [;;4mfile[0m usually treat binaries as raw
  filenames, that is, they are passed "as is" even when the encoding
  of the binary does not agree with [;;4mnative_name_encoding()[0m.
  However, this function expects binaries to be encoded according to
  the value returned by [;;4mnative_name_encoding/0[0m.

  Typical error reasons are:

   • [;;4menoent[0m - The directory does not exist.

   • [;;4menotdir[0m - A component of [;;4mDir[0m is not a directory. On some
     platforms, [;;4menoent[0m is returned.

   • [;;4meacces[0m - Missing permission for the directory or one of its
     parents.

   • [;;4mbadarg[0m - [;;4mDir[0m has an improper type, such as tuple.

   • [;;4mno_translation[0m - [;;4mDir[0m is a [;;4mbinary/0[0m with characters
     coded in ISO-latin-1 and the VM is operating with unicode
     filename encoding.

  [;;4mWarning[0m

    In a future release, a bad type for argument [;;4mDir[0m will
    probably generate an exception.
