-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error message when input path doesn't exist (#2092)
Previously if you call Juvix on a file that doesn't exist you get the error: ``` $ juvix compile /i/don't/exist.juvix juvix: /i/dont: changeWorkingDirectory: does not exist (No such file or directory) ``` After this change you will see: ``` $ juvix compile /i/don't/exist.juvix The input path "/i/dont/exist.juvix" does not exist ```
- Loading branch information
1 parent
2b0668b
commit 8eb4c64
Showing
6 changed files
with
68 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module Juvix.Prelude.Path.SomePath where | ||
|
||
import Juvix.Prelude.Base | ||
import Path | ||
import Path.IO | ||
import Prelude qualified | ||
|
||
data SomePath b | ||
= File (Path b File) | ||
| Dir (Path b Dir) | ||
|
||
-- | Return the directory containing a path. i.e the path itself if it is a | ||
-- directory or its parent if it is a file. | ||
containingDir :: SomePath b -> Path b Dir | ||
containingDir = \case | ||
File f -> parent f | ||
Dir d -> d | ||
|
||
doesSomePathExist :: SomePath b -> IO Bool | ||
doesSomePathExist = \case | ||
File p -> doesPathExist p | ||
Dir p -> doesPathExist p | ||
|
||
instance Show (SomePath b) where | ||
show = \case | ||
File p -> show p | ||
Dir p -> show p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters