File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -50,10 +50,20 @@ type ByteCount = Int
5050--
5151data SymlinkType = FileLink | DirLink | JunctionLink
5252
53+ -- |
54+ -- Convert a `SymlinkType` to a `String` expected by the Node.js filesystem
55+ -- API.
56+ --
57+ symlinkTypeToNode :: SymlinkType -> String
58+ symlinkTypeToNode ty = case ty of
59+ FileLink -> " file"
60+ DirLink -> " dir"
61+ JunctionLink -> " junction"
62+
5363instance showSymlinkType :: Show SymlinkType where
54- show FileLink = " file "
55- show DirLink = " dir "
56- show JunctionLink = " junction "
64+ show FileLink = " FileLink "
65+ show DirLink = " DirLink "
66+ show JunctionLink = " JunctionLink "
5767
5868instance eqSymlinkType :: Eq SymlinkType where
5969 eq FileLink FileLink = true
Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ symlink :: forall eff. FilePath
167167 -> Eff (fs :: FS | eff ) Unit
168168
169169symlink src dest ty cb = mkEff $ \_ -> runFn4
170- fs.symlink src dest (show ty) (handleCallback cb)
170+ fs.symlink src dest (symlinkTypeToNode ty) (handleCallback cb)
171171
172172-- |
173173-- Reads the value of a symlink.
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ symlink :: forall eff. FilePath
144144 -> Eff (fs :: FS , err :: EXCEPTION | eff ) Unit
145145
146146symlink src dst ty = mkEff $ \_ -> runFn3
147- fs.symlinkSync src dst (show ty)
147+ fs.symlinkSync src dst (symlinkTypeToNode ty)
148148
149149-- |
150150-- Reads the value of a symlink.
You can’t perform that action at this time.
0 commit comments