Name

SPVM::Cwd - Getting Pathname of Current Working Directory

Description

Cwd class in SPVM has methods to get the pathname of the current working directory.

Usage

use Cwd;

my $dir = Cwd->getcwd;

my $abs_path = Cwd->abs_path($file);

Class Methods

getcwd

static method getcwd : string ();

Calls the getcwd method in the Sys::IO class and returns the return value.

On Windows, the path separaters \ of the return value are replaced with /.

abs_path

static method abs_path : string ($file :string);

The alias for the "realpath" method.

realpath

static method realpath : string ($file : string);

Calls realpath system cal given the file $file, and returns its return value.

In Windows, realpath system call is emulated by GetFullPathNameW function.

The path separaters \ of the return value are replaced with / on Windows.

getdcwd

static method getdcwd : string ($drive : string = undef);

The $drive is a drive letter such as C:, D:. It is converted to the drive id.

And calls the _getdcwd method in the Sys::IO returns the return value.

On Windows, the path separaters \ of the return value are replaced with /

Exceptions:

The getdcwd is not supported on this system(_WIN32).

The length of the $drive must be 2.

The first character of the $drive must be [a-zA-Z].

The second character of the $drive must be ":".

See Also

Porting

SPVM::Cwd is a Perl's Cwd porting to SPVM.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License