Fix file open path error

master
Nick Paul 2017-08-04 08:39:12 -04:00
parent fbcf016dbd
commit b008582630
2 changed files with 2 additions and 11 deletions

View File

@ -24,7 +24,7 @@ include("cmds/echo.jl")
function acorn(filename::String; rel::Bool=true) function acorn(filename::String; rel::Bool=true)
ed = Editor() ed = Editor()
rel && (filename = abspath(filename)) #rel && (filename = abspath(filename))
editorOpen(ed, filename) editorOpen(ed, filename)

View File

@ -68,19 +68,10 @@ end
# FILE OPERATIONS # # FILE OPERATIONS #
################### ###################
function expand(filename::String)
# If the path is something like "~/Desktop/..." expand it
if length(filename) > 1 && filename[1] == '~'
filename = expanduser(filename)
end
return filename
end
""" Open a file and read the lines into the ed.rows array """ """ Open a file and read the lines into the ed.rows array """
function editorOpen(ed::Editor, filename::String) function editorOpen(ed::Editor, filename::String)
try try
filename = expand(filename) filename = expanduser(filename)
# If no file exists, create it # If no file exists, create it
!isfile(filename) && open(filename, "w") do f end !isfile(filename) && open(filename, "w") do f end