Module: SimpleCov::CLI::JDKRealPath
Overview
The JDK's answer to File.realpath and File.realdirpath, for JRuby. On Windows JRuby's own versions follow no symlinks, and realdirpath accepts a directory that does not exist, so the CLI's containment and identity checks would compare paths that were never resolved. Path#toRealPath has neither problem on any OS. The path is expanded first because the JDK resolves a relative path against the JVM's working directory, which Dir.chdir does not move.
simplecov:disable — JRuby-only; this suite's coverage is measured on CRuby
Instance Method Summary collapse
-
#realdirpath(path) ⇒ Object
mutant:disable — JRuby-only, unreachable from the engine mutant runs on.
-
#realpath(path) ⇒ Object
mutant:disable — JRuby-only, unreachable from the engine mutant runs on.
Instance Method Details
#realdirpath(path) ⇒ Object
mutant:disable — JRuby-only, unreachable from the engine mutant runs on
30 31 32 33 34 35 |
# File 'lib/simplecov/cli/real_path.rb', line 30 def realdirpath(path) = File.(path) return realpath() if File.exist?() File.join(realpath(File.dirname()), File.basename()) end |
#realpath(path) ⇒ Object
mutant:disable — JRuby-only, unreachable from the engine mutant runs on
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/simplecov/cli/real_path.rb', line 18 def realpath(path) = File.(path) java.nio.file.Paths.get().toRealPath.toString.tr("\\", "/") # steep:ignore NoMethod rescue java.nio.file.NoSuchFileException, java.nio.file.NotDirectoryException # steep:ignore NoMethod raise Errno::ENOENT, rescue java.nio.file.AccessDeniedException # steep:ignore NoMethod raise Errno::EACCES, rescue java.nio.file.InvalidPathException # steep:ignore NoMethod raise Errno::EINVAL, end |