Merge pull request #6628 from dearblue/File.absolute_path

This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-09-23 07:52:14 +01:00
committed by GitHub
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -653,7 +653,7 @@ mrb_file_absolute_path(mrb_state *mrb, mrb_value self)
const char *path;
const char *default_dir = ".";
mrb_get_args(mrb, "z|z", &path, &default_dir);
return path_expand(mrb, path, default_dir, TRUE);
return path_expand(mrb, path, default_dir, FALSE);
}
/*
+5
View File
@@ -315,6 +315,11 @@ assert('File.expand_path (with getenv(3))') do
assert_equal "#{MRubyIOTestUtil::ENV_HOME}/user", File.expand_path("user", MRubyIOTestUtil::ENV_HOME), "relative with base_dir"
end
assert('File.absolute_path') do
assert_equal File.expand_path("./~"), File.absolute_path("~")
assert_equal File.expand_path("./~user1"), File.absolute_path("~user1")
end
if MRubyIOTestUtil.win?
assert('File.absolute_path? (for windows)') do
assert_true File.absolute_path?("c:/")