diff --git a/src/cli_open.jl b/src/cli_open.jl
index cdb08e21b4551d50da4ae9c5ea35e5d5c3b90575..900d9a4d1f1a7ff8865a98ce8f88108f144468c8 100644
--- a/src/cli_open.jl
+++ b/src/cli_open.jl
@@ -54,8 +54,14 @@ function main(args=ARGS; exit_on_error=false)
     infile = parsed_args["<file-path>"]
     if isempty(infile)
         infile = nothing
-    elseif !(startswith(infile, "http://") || isfile(infile))
-        if isdir(infile)
+    elseif !startswith(infile, "http://")
+        if isfile(infile)
+            dataroot = dirname(infile)
+            if !isempty(dataroot)
+                cd(dataroot)
+                infile = basename(infile)
+            end
+        elseif isdir(infile)
             dataroot = infile
             infile = nothing
             cd(dataroot)