GOLF(2gg)

NAME
change-dir - (directories)

PURPOSE
Change current working directory.

SYNTAX

        change-dir [ <directory>  | home | run-dir ] [ status <status> ]

DESCRIPTION
change-dir will change current working directory to <directory> (which is a string that can be an absolute or relative path), or to application home directory (see directories) if "home" clause is used.

If "run-dir" clause is used, then current working directory is changed to the directory where you ran the program from. Note that this only applies to command-line programs. If you program runs as a service, then this clause has the same effect as "home" clause.

If "status" clause is used, then number <status> is GG_OKAY if change-dir is successful, or GG_FAILED if not (in which case you can use "errno" clause in get-req to find the specific reason why).

Note that if you change current working directory with call-extended, then you must set Golf internal boolean variable "gg_path_changed" to true.

EXAMPLES

        change-dir "/home/user/new_dir" status s
        if-true s equal GG_OKAY
            @Directory changed
        else
            get-req errno to eno
            @Error <<print-out eno>>
        end-if

Use relative path:

        change-dir "./new_dir"

Go back to application home directory:

        change-dir home

SEE ALSO
 Directories

change-dir change-mode delete-dir directories new-dir See all documentation