-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
all sandbox methods should return Abs Paths? #53
Comments
or maybe this is ok, since I can write sandboxOrThrow
:: forall a b m
. IsRelOrAbs a
=> IsDirOrFile b
=> MonadThrow Error m
=> Path Abs Dir
-> Path a b
-> m (SandboxedPath a b)
sandboxOrThrow root path = sandbox root path # maybe (throwError $ error $ "cannot sandbox path: root = " <> show root <> ", path = " <> show path) pure
(outerTmpDir :: SandboxedPath Rel Dir) <- sandboxOrThrow cwd (currentDir </> dir (Proxy :: _ "tmp") </> dir (Proxy :: _ "dir-entries-test"))
but on other hand - what is the use of |
well, someone could write -- ./mydir/ -> ./mydir/myfile.txt
-- /myabspath/mydir/ -> /myabspath/mydir/myfile.txt
getFirstFile :: FilePath -> Aff FilePath
getFirstFile = ...
getFirstFileAff
:: forall relOrAbs
. IsRelOrAbs relOrAbs
=> SandboxedPath relOrAbs Dir
-> Aff (Maybe (Path relOrAbs File))
getFirstFileAff path = do
let printedPath = printPath currentPrinter path
(maybeFile :: Maybe FilePath) <- Node.FS.getFirstFile path
map (parse currentParser parseRelFile # ...) maybeFile and this would be wrong - it can only ever be getFirstFileAff
:: forall relOrAbs
. IsRelOrAbs relOrAbs
=> SandboxedPath relOrAbs Dir
-> Aff (Maybe (Path Abs File)) |
srghma
added a commit
to srghma/purescript-pathy
that referenced
this issue
Oct 9, 2024
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
I write https://github.com/srghma/purescript-pathy-node/blob/56c0cbce481ac50b11f5b66690967701a5281d65/test/Test/Main.purs#L109-L110
and it gives
"/tmp/dir-entries-test/"
and I'm like "WHAAT, should be rel"
To Reproduce
add this to tests
Expected behavior
maybe
data SandboxedPath a b = SandboxedPath (Path Abs Dir) (Path a b)
should be
data SandboxedPath dirOrFile = SandboxedPath (Path Abs Dir) (Path Abs dirOrFile)
The text was updated successfully, but these errors were encountered: