Fix file open path error
parent
fbcf016dbd
commit
b008582630
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue