Name

SPVM::Cwd - Getting Pathname of Current Working Directory

Description

The Cwd class of 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 the realpath method in the Sys::IO class except for Windows and returns the return value.

On Windows, Calls the _fullpath method in the Sys::IO class and returns the return value.

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

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 ":".

Repository

https://github.com/yuki-kimoto/SPVM-Cwd

See Also

SPVM::Sys

SPVM::Sys provides system calls for changing working directory. SPVM::Cwd calls the methods in the SPVM::Sys class.

Cwd

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

Author

Yuki Kimoto kimoto.yuki@gmail.com

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License