File.expand_path is way more useful than File.absolute_path

This commit is contained in:
Gwenhael Le Moine 2022-10-04 14:57:13 +02:00
parent 7a157faee0
commit dfac755ce5
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
2 changed files with 3 additions and 3 deletions

View file

@ -73,7 +73,7 @@ interpreter = Rpl.new
# first run provided files if any # first run provided files if any
options[:files].each do |filename| options[:files].each do |filename|
interpreter.run "\"#{filename}\" feval" interpreter.run "\"#{File.expand_path( filename )}\" feval"
end end
# second run provided code if any # second run provided code if any

View file

@ -16,7 +16,7 @@ module RplLang
proc do proc do
args = stack_extract( [[RplString]] ) args = stack_extract( [[RplString]] )
path = File.absolute_path( args[0].value ) path = File.expand_path( args[0].value )
@stack << Types.new_object( RplString, "\"#{File.read( path )}\"" ) @stack << Types.new_object( RplString, "\"#{File.read( path )}\"" )
end ) end )
@ -32,7 +32,7 @@ module RplLang
proc do proc do
args = stack_extract( [[RplString], :any] ) args = stack_extract( [[RplString], :any] )
File.write( File.absolute_path( args[0].value ), File.write( File.expand_path( args[0].value ),
args[1].value ) args[1].value )
end ) end )
end end