diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-02-06 18:36:25 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-02-06 18:36:25 +0900 |
| commit | c6c632cf97719e7b2d7e1e574eec95dfc6a47d2d (patch) | |
| tree | c6dbb7c8a994f5a9be62f39c445ed2dc26b23f53 | |
| parent | 94d8dfed6647f7c90074c2681f09ab04d27e7072 (diff) | |
| parent | e0d2f4e0aece2c69c2938f83cf18cf33481a13fa (diff) | |
| download | mruby-c6c632cf97719e7b2d7e1e574eec95dfc6a47d2d.tar.gz mruby-c6c632cf97719e7b2d7e1e574eec95dfc6a47d2d.zip | |
Merge pull request #5325 from dearblue/c++-exc.2
`compile_as_cxx` should generate a path under` conf.build_dir`
| -rw-r--r-- | lib/mruby/build.rb | 2 | ||||
| -rw-r--r-- | lib/mruby/core_ext.rb | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/mruby/build.rb b/lib/mruby/build.rb index a79732802..b9f26d49f 100644 --- a/lib/mruby/build.rb +++ b/lib/mruby/build.rb @@ -248,7 +248,7 @@ module MRuby end end else - cxx_src = "#{build_dir}/#{src.relative_path})".ext << "-cxx.cxx" + cxx_src = "#{build_dir}/#{src.relative_path.to_s.remove_leading_parents}".ext << "-cxx.cxx" obj = cxx_src.ext(@exts.object) end diff --git a/lib/mruby/core_ext.rb b/lib/mruby/core_ext.rb index 33454edad..1ad528c26 100644 --- a/lib/mruby/core_ext.rb +++ b/lib/mruby/core_ext.rb @@ -18,6 +18,10 @@ class String def relative_path relative_path_from(Dir.pwd) end + + def remove_leading_parents + Pathname.new(".#{Pathname.new("/#{self}").cleanpath}").cleanpath.to_s + end end def install_D(src, dst) |
