Skip to content

Commit

Permalink
Merge pull request sequelize#138 from rprouse/issue/136
Browse files Browse the repository at this point in the history
If the OS is windows, convert line endings from LF to CRLF when saving
  • Loading branch information
kytrinyx committed Oct 16, 2014
2 parents c353407 + a341082 commit 149de14
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions user/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"io/ioutil"
"os"
"path/filepath"
"runtime"
"strings"

"github.com/exercism/cli/api"
)
Expand Down Expand Up @@ -59,6 +61,10 @@ func (it *Item) Save() error {
it.isUpdated = true
}

if runtime.GOOS == "windows" {
text = strings.Replace(text, "\n", "\r\n", -1)
}

if err := ioutil.WriteFile(file, []byte(text), 0644); err != nil {
return err
}
Expand Down

0 comments on commit 149de14

Please sign in to comment.