るりまサーチ

最速Rubyリファレンスマニュアル検索!
66件ヒット [1-66件を表示] (0.016秒)
トップページ > クエリ:realpath[x]

別のキーワード

  1. pathname realpath
  2. file realpath
  3. _builtin realpath
  4. realpath pathname

ライブラリ

クラス

モジュール

キーワード

検索結果

File.realpath(pathname, basedir = nil) -> String (18119.0)

与えられた pathname に対応する絶対パスを返します。

...合に発生します。

//emlist[例][ruby]{
ENV["HOME"] # => "/home/matz"
File.symlink("testfile", "testlink")
File.realpath("testfile") # => "/home/matz/testfile"
File.realpath("testlink") # => "/home/matz/testfile"
File.realpath("..", "/tmp") # => "/"
//}...

Pathname#realpath -> Pathname (18114.0)

余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。

...r") rescue nil

Dir.mkdir("/tmp/foo")
Dir.mkdir("/tmp/bar")
File.symlink("../foo", "/tmp/bar/foo")
path = Pathname.new("bar/././//foo/../bar")

Dir.chdir("/tmp")

p path.realpath

# => ruby 1.8.0 (2003-10-10) [i586-linux]
# #<Pathname:/tmp/bar>
//}

@see Pathname#realdirpath, File.realpath...

Pathname#realpath(basedir = nil) -> Pathname (18114.0)

余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。

...r") rescue nil

Dir.mkdir("/tmp/foo")
Dir.mkdir("/tmp/bar")
File.symlink("../foo", "/tmp/bar/foo")
path = Pathname.new("bar/././//foo/../bar")

Dir.chdir("/tmp")

p path.realpath

# => ruby 1.8.0 (2003-10-10) [i586-linux]
# #<Pathname:/tmp/bar>
//}

@see Pathname#realdirpath, File.realpath...

Pathname#realdirpath(basedir = nil) -> Pathname (28.0)

Pathname#realpath とほぼ同じで、最後のコンポーネントは実際に 存在しなくてもエラーになりません。

...Pathname#realpath とほぼ同じで、最後のコンポーネントは実際に
存在しなくてもエラーになりません。

@param basedir ベースディレクトリを指定します。省略するとカレントディレクトリになります。

//emlist[例][ruby]{
require "pathna...
...st")
path.realdirpath # => #<Pathname:/not_exist>
path.realpath # => Errno::ENOENT

# 最後ではないコンポーネント(/not_exist_1)も存在しないのでエラーになる。
path = Pathname("/not_exist_1/not_exist_2")
path.realdirpath # => Errno::ENOENT
//}

@see Pathname#realpath...

Kernel#create_header(header = "extconf.h") -> String (12.0)

Kernel#have_func, Kernel#have_header などの検査結果を元に、 ヘッダファイルを生成します。

...# extconf.rb
require 'mkmf'
have_func('realpath')
have_header('sys/utime.h')
create_header
create_makefile('foo')

上の extconf.rb は以下の extconf.h を生成します。

#ifndef EXTCONF_H
#define EXTCONF_H
#define HAVE_REALPATH 1
#define HAVE_SYS_UTIME_H 1
#endif...

絞り込み条件を変える

NEWS for Ruby 2.7.0 (12.0)

NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...した。

//emlist{
$ ./configure --with-coroutine=ucontext
$ ./configure --with-coroutine=copy
//}

* File
* File.realpathは多くのプラットフォームでrealpath(3)を使います。
これは大幅にパフォーマンスを改善します。 15797

* Hash
* 小さいHas...