Go to: Synopsis. Return value. Related. MEL examples.

Synopsis

pwd

pwd is NOT undoable, NOT queryable, and NOT editable.

Returns a string representing the path of the current working directory for the application. This starts out as the directory where Maya was launched, but will change in response to chdir commands as well as some file browsing operations. This directory is where system-level commands such as system, fopen, and popen. The working directory is not related to the workspace directories where scene data is stored, and should not be used for accessing or creating scene- or project-specific files.

Return value

string Current working directory

Related

chdir, workspace

MEL examples

// The "pwd" comes in handy here since this proc will just create a
// lockfile in the current working directory, without having to
// explicitly know what it is. It can be used in conjunction with
// the "chdir" command to move amongst various directories that the
// user can vary at will.
//
global proc lockCurrentWorkingDirectory()
{
    string $s = `pwd`;
    int $fileId = `fopen ($s + "/LOCK") "w"`;
    fprint $fileId "LOCKED\n";
    fclose $fileId;
}