File.expand_path is way more useful than File.absolute_path
This commit is contained in:
parent
7a157faee0
commit
dfac755ce5
2 changed files with 3 additions and 3 deletions
2
bin/rpl
2
bin/rpl
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue