allow navigating to parent directors in chooseFileInDir
This commit is contained in:
@@ -97,11 +97,16 @@
|
|||||||
(awaitLet [,v (quickPickMap ,options)]
|
(awaitLet [,v (quickPickMap ,options)]
|
||||||
,@body)))
|
,@body)))
|
||||||
|
|
||||||
// TODO allow navigating back up to a parent directory
|
|
||||||
(function :Void chooseFileInDir [:String->Void openFile :Bool allowNew &opt :String dir]
|
(function :Void chooseFileInDir [:String->Void openFile :Bool allowNew &opt :String dir]
|
||||||
(withValueOrInputBox dir
|
(withValueOrInputBox dir
|
||||||
(awaitLet [dirOrFile ((if allowNew autoSuggestPick quickPick) (sys.FileSystem.readDirectory dir))]
|
(set dir (dir.replace "\\" "/"))
|
||||||
(let [dirOrFile (joinPath dir dirOrFile)]
|
(when (dir.endsWith "/") (set dir (substr dir 0 -1)))
|
||||||
|
(awaitLet [dirOrFile ((if allowNew autoSuggestPick quickPick) (concat [".."] (sys.FileSystem.readDirectory dir)))]
|
||||||
|
(let [dirOrFile
|
||||||
|
(case dirOrFile
|
||||||
|
(".."
|
||||||
|
(substr dir 0 (dir.lastIndexOf "/")))
|
||||||
|
(otherwise (joinPath dir dirOrFile)))]
|
||||||
(cond
|
(cond
|
||||||
((sys.FileSystem.isDirectory dirOrFile)
|
((sys.FileSystem.isDirectory dirOrFile)
|
||||||
(chooseFileInDir openFile allowNew dirOrFile))
|
(chooseFileInDir openFile allowNew dirOrFile))
|
||||||
|
Reference in New Issue
Block a user