New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
with Ada.Directories; use Ada.Directories;
Dir : String := Current_Directory;
#include <unistd.h>
char *dir = getcwd(NULL, 0);
#include <filesystem>
dir = std::filesystem::current_path();
using System.IO;
string path = Directory.GetCurrentDirectory();
import std.path;
string dir = absolutePath;
import "os"
dir, err := os.Getwd()
import System.Directory
dir <- getCurrentDirectory
let dir = process.cwd ()
String path = this.getClass().getClassLoader().getResource("").getPath();
dir = os.getenv("PWD") or io.popen("cd"):read()
$dir = getcwd();
dir := expandfilename('.');
use Cwd;
my $dir = getcwd();
import os
dir = os.getcwd()
dir = Dir.pwd
use std::env;
let dir = env::current_dir().unwrap();