elm-format
elm-format copied to clipboard
elm-format in Windows cygwin cannot find files in mounted drive
elm-format cannot read a filepath specified.
OS: Windows 7 Shell: cygwin
Show file:
$ cat /1.elm
module Foo.External exposing (..)
import Json.Decode as JD exposing (Decoder)
import Json.Decode.Pipeline as JDP exposing (decode)
import Foo.Types exposing (..)
jobDecoder : Decoder Model
jobDecoder =
decode Model
|> JDP.required "id" JD.string
Mounting:
$ mount
C:/workspace/ext/cygwin/bin on /usr/bin type ntfs (binary,auto)
C:/workspace/ext/cygwin/lib on /usr/lib type ntfs (binary,auto)
C:/workspace/ext/cygwin/tmp on /tmp type ntfs (binary,user)
Problem with this command
$ elm-format /tmp/1.elm
There was a problem reading one or more of the specified input files:
/tmp/1.elm: File does not exist
Please check the given paths.
It only works when I supply with the machine path:
$ elm-format C:/workspace/ext/cygwin/tmp/1.elm
This will overwrite the following files to use Elm's preferred style:
C:/workspace/ext/cygwin/tmp/1.elm
This cannot be undone! Make sure to back up these files before proceeding.
Are you sure you want to overwrite these files with formatted versions? (y/n)
I've fixed it locally by replacing this:
" call elm-format on the temporary file
" exceptional handling for cygwin
if has('win32unix') || has('win64unix')
let l:out = system('elm-format $(cygpath -w ' . l:tmpname . ') --output $(cygpath -w ' . l:tmpname . ')')
else
let l:out = system('elm-format ' . l:tmpname . ' --output ' . l:tmpname)
endif
@geekyme Thank you very much for this tip! You saved me a lot of headache today!