GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
I'm not the most experienced Rubyist, but I've been enjoying using Wrong, and thought I'd have a go at fixing this issue since most of my hobbyprogramming is done on windows.
My approach is simply to check whether a path is absolute or relative by calling File.file? on it.
Fix for Issue 16 "Wrong::Config.read_here_or_higher can't handle abso…
…lute paths". Checks whether path is absolute or relative simply by calling File.file? on the path.
Why not just File.expand_path(file, dir) ?
@Ehyeh-Asher-Ehyeh File.expand_path works similar:
> File.expand_path("/abs", '/root')
> File.expand_path("rel", '/root')
> File.expand_path("../rel", '/root/subroot')
You can replace your get_file_path by File.expand.
File.read File.expand(file, dir)