Skip to content

Commit

Permalink
copy config file via ioutil
Browse files Browse the repository at this point in the history
  • Loading branch information
fffw committed Sep 14, 2015
1 parent 913cee7 commit 9a42cf8
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/github.com/getlantern/flashlight/client/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ package client

import (
"errors"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
Expand Down Expand Up @@ -87,16 +85,13 @@ func MakeInitialConfig(configPath string) error {
if err != nil {
return err
}
var cmd, option string
if runtime.GOOS == "windows" {
cmd, option = "copy", "/y"
} else {
cmd, option = "cp", "-f"
bytes, err := ioutil.ReadFile(src)
if err != nil {
return err
}

cl := exec.Command(cmd, option, src, configPath)
if out, err := cl.Output(); err != nil {
return fmt.Errorf("Could not copy %s to %s: %v(%s)", src, configPath, err, string(out))
err = ioutil.WriteFile(configPath, bytes, 0644)
if err != nil {
return err
}
return nil
}
Expand Down

0 comments on commit 9a42cf8

Please sign in to comment.