Get current working directory from a console application

How would I get the user’s current working directory from the Terminal when they are running my console application? As an example, if my console application is stored in /usr/local/bin (and can therefore be run from anywhere in the terminal if /usr/local/bin is in the PATH) and the user is calling my tool from ~Desktop/SomeFolder, how can I get a FolderItem reference to SomeFolder?

Is this possible?

SpecialFolder.CurrentWorkingDirectory.

Doh.

Or app.ExecutableFile for the console application itself.

Actually… this isn’t always true. If the console app was launched from another directory the cwd would be where you launched from, not where the app is.