The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

SPVM::Cwd - Getting Pathname of Current Working Directory

Usage

  use Cwd;
  
  my $dir = Cwd->getcwd;
  
  my $abs_path = Cwd->abs_path($file);

Description

SPVM::Cwd provides methods for determining the pathname of the current working directory.

This module is the Perl's Cwd porting to SPVM.

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 = undef : string) {

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 2022-2023 Yuki Kimoto, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.