Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[WE-168] Path bugfix win#270

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
facchinm merged 7 commits intodevelfrompath_bugfix_win
Nov 28, 2018
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
229 changes: 104 additions & 125 deletionsGopkg.lock
View file
Open in desktop

Large diffs are not rendered by default.

117 changes: 6 additions & 111 deletionsGopkg.toml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,76 +27,28 @@

[[constraint]]
name = "github.com/Sirupsen/logrus"
version = "1.0.6"
version = "1.2.0"

[[constraint]]
name = "github.com/blang/semver"
version = "3.5.1"

[[constraint]]
branch = "master"
name = "github.com/creack/goselect"

[[constraint]]
branch = "master"
name = "github.com/getlantern/context"

[[constraint]]
branch = "master"
name = "github.com/getlantern/errors"

[[constraint]]
branch = "master"
name = "github.com/getlantern/filepersist"

[[constraint]]
branch = "master"
name = "github.com/getlantern/golog"

[[constraint]]
branch = "master"
name = "github.com/getlantern/hex"

[[constraint]]
branch = "master"
name = "github.com/getlantern/hidden"

[[constraint]]
branch = "master"
name = "github.com/getlantern/ops"

[[constraint]]
name = "github.com/getlantern/stack"
version = "1.5.1"

[[constraint]]
branch = "master"
revision = "89b3d9c45cc69f861868cc7f3159eba2b4cdfb22"
name = "github.com/getlantern/systray"

[[constraint]]
name = "github.com/gin-gonic/gin"
version = "1.2.0"
version = "1.3.0"

[[constraint]]
name = "github.com/go-ini/ini"
version = "1.38.1"

[[constraint]]
branch = "master"
name = "github.com/googollee/go-engine.io"
version = "1.39.0"

[[constraint]]
branch = "master"
name = "github.com/googollee/go-socket.io"

[[constraint]]
name = "github.com/gorilla/websocket"
version = "1.2.0"

[[constraint]]
branch = "filemode"
name = "github.com/inconshreveable/go-update"

[[constraint]]
name = "github.com/itsjamie/gin-cors"
version = "1.0.0"
Expand All@@ -109,37 +61,13 @@
name = "github.com/kr/binarydist"
version = "0.1.0"

[[constraint]]
name = "github.com/kr/fs"
version = "0.1.0"

[[constraint]]
branch = "master"
name = "github.com/manucorporat/sse"

[[constraint]]
name = "github.com/mattn/go-colorable"
version = "0.0.9"

[[constraint]]
name = "github.com/mattn/go-isatty"
version = "0.0.3"

[[constraint]]
name = "github.com/mattn/go-ole"
version = "1.2.1"

[[constraint]]
name = "github.com/mattn/go-shellwords"
version = "1.0.3"

[[constraint]]
name = "github.com/miekg/dns"
version = "1.0.8"

[[constraint]]
branch = "master"
name = "github.com/mitchellh/go-homedir"
version = "1.0.0"

[[constraint]]
branch = "master"
Expand All@@ -149,10 +77,6 @@
name = "github.com/pkg/errors"
version = "0.8.0"

[[constraint]]
name = "github.com/pkg/sftp"
version = "1.8.0"

[[constraint]]
branch = "master"
name = "github.com/sfreiberg/simplessh"
Expand All@@ -161,18 +85,6 @@
branch = "master"
name = "github.com/skratchdot/open-golang"

[[constraint]]
name = "github.com/smartystreets/goconvey"
version = "1.6.3"

[[constraint]]
name = "github.com/stretchr/testify"
version = "1.2.2"

[[constraint]]
branch = "master"
name = "github.com/vharitonsky/iniflags"

[[constraint]]
branch = "master"
name = "github.com/xrash/smetrics"
Expand All@@ -185,27 +97,10 @@
branch = "master"
name = "golang.org/x/crypto"

[[constraint]]
branch = "master"
name = "golang.org/x/net"

[[constraint]]
branch = "master"
name = "golang.org/x/sys"

[[constraint]]
name = "gopkg.in/bluesuncorp/validator.v5"
version = "5.12.0"

[[constraint]]
branch = "v0"
name = "gopkg.in/inconshreveable/go-update.v0"

[[constraint]]
name = "gopkg.in/ini.v1"
version = "1.38.1"

[prune]
non-go = true
go-tests = true
unused-packages = true
unused-packages = true
2 changes: 1 addition & 1 deletionmain.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -335,7 +335,7 @@ var homeTemplate = template.Must(template.New("home").Parse(homeTemplateHtml))
const homeTemplateHtml = `<!DOCTYPE html>
<html>
<head>
<title>Serial Port Example</title>
<title>Arduino Create Agent Debug Console</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.5/socket.io.min.js"></script>
<script type="text/javascript">
Expand Down
81 changes: 44 additions & 37 deletionstools/download.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@ import (
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
Expand DownExpand Up@@ -226,7 +227,7 @@ func (t *Tools) Download(pack, name, version, behaviour string) error {
// Decompress
t.Logger("Unpacking tool " + name)

location := path.Join(dir(), pack, correctTool.Name, correctTool.Version)
location := path.Join(dir(), pack, correctTool.Name, correctTool.Version)
err = os.RemoveAll(location)

if err != nil {
Expand All@@ -240,12 +241,12 @@ func (t *Tools) Download(pack, name, version, behaviour string) error {

switch srcType {
case "application/zip":
location, err = extractZip(body, location)
location, err = extractZip(t.Logger,body, location)
case "application/x-bz2":
case "application/octet-stream":
location, err = extractBz2(body, location)
location, err = extractBz2(t.Logger,body, location)
case "application/x-gzip":
location, err = extractTarGz(body, location)
location, err = extractTarGz(t.Logger,body, location)
default:
return errors.New("Unknown extension for file " + correctSystem.URL)
}
Expand DownExpand Up@@ -376,7 +377,7 @@ func removeStringFromSlice(s []string, r string) []string {

func findBaseDir(dirList []string) string {
if len(dirList) == 1 {
returnfilepath.Dir(dirList[0]) + "/"
returnpath.Dir(dirList[0]) + "/"
}

// https://github.com/backdrop-ops/contrib/issues/55#issuecomment-73814500
Expand All@@ -385,14 +386,14 @@ func findBaseDir(dirList []string) string {
dirList = removeStringFromSlice(dirList, v)
}

commonBaseDir := commonPrefix(os.PathSeparator, dirList)
commonBaseDir := commonPrefix('/', dirList)
if commonBaseDir != "" {
commonBaseDir = commonBaseDir + "/"
}
return commonBaseDir
}

func extractZip(body []byte, location string) (string, error) {
funcextractZip(log func(msg string) ,body []byte, location string) (string, error) {
path, err := utilities.SaveFileonTempDir("tooldownloaded.zip", bytes.NewReader(body))
r, err := zip.OpenReader(path)
if err != nil {
Expand All@@ -406,9 +407,11 @@ func extractZip(body []byte, location string) (string, error) {
}

basedir := findBaseDir(dirList)
log(fmt.Sprintf("selected baseDir %s from Zip Archive Content: %v", basedir, dirList))

for _, f := range r.File {
fullname := filepath.Join(location, strings.Replace(f.Name, basedir, "", -1))
log(fmt.Sprintf("generated fullname %s removing %s from %s", fullname, basedir, f.Name))
if f.FileInfo().IsDir() {
os.MkdirAll(fullname, f.FileInfo().Mode().Perm())
} else {
Expand DownExpand Up@@ -439,7 +442,7 @@ func extractZip(body []byte, location string) (string, error) {
return location, nil
}

func extractTarGz(body []byte, location string) (string, error) {
func extractTarGz(log func(msg string),body []byte, location string) (string, error) {
bodyCopy := make([]byte, len(body))
copy(bodyCopy, body)
tarFile, _ := gzip.NewReader(bytes.NewReader(body))
Expand All@@ -456,6 +459,7 @@ func extractTarGz(body []byte, location string) (string, error) {
}

basedir := findBaseDir(dirList)
log(fmt.Sprintf("selected baseDir %s from TarGz Archive Content: %v", basedir, dirList))

tarFile, _ = gzip.NewReader(bytes.NewReader(bodyCopy))
tarReader = tar.NewReader(tarFile)
Expand DownExpand Up@@ -502,36 +506,8 @@ func extractTarGz(body []byte, location string) (string, error) {
return location, nil
}

func (t *Tools) installDrivers(location string) error {
OK_PRESSED := 6
extension := ".bat"
preamble := ""
if runtime.GOOS != "windows" {
extension = ".sh"
// add ./ to force locality
preamble = "./"
}
if _, err := os.Stat(filepath.Join(location, "post_install"+extension)); err == nil {
t.Logger("Installing drivers")
ok := MessageBox("Installing drivers", "We are about to install some drivers needed to use Arduino/Genuino boards\nDo you want to continue?")
if ok == OK_PRESSED {
os.Chdir(location)
t.Logger(preamble + "post_install" + extension)
oscmd := exec.Command(preamble + "post_install" + extension)
if runtime.GOOS != "linux" {
// spawning a shell could be the only way to let the user type his password
TellCommandNotToSpawnShell(oscmd)
}
err = oscmd.Run()
return err
} else {
return errors.New("Could not install drivers")
}
}
return nil
}

func extractBz2(body []byte, location string) (string, error) {
funcextractBz2(log func(msg string),body []byte, location string) (string, error) {
bodyCopy := make([]byte, len(body))
copy(bodyCopy, body)
tarFile := bzip2.NewReader(bytes.NewReader(body))
Expand All@@ -548,6 +524,7 @@ func extractBz2(body []byte, location string) (string, error) {
}

basedir := findBaseDir(dirList)
log(fmt.Sprintf("selected baseDir %s from Bz2 Archive Content: %v", basedir, dirList))

tarFile = bzip2.NewReader(bytes.NewReader(bodyCopy))
tarReader = tar.NewReader(tarFile)
Expand DownExpand Up@@ -596,6 +573,36 @@ func extractBz2(body []byte, location string) (string, error) {
return location, nil
}


func (t *Tools) installDrivers(location string) error {
OK_PRESSED := 6
extension := ".bat"
preamble := ""
if runtime.GOOS != "windows" {
extension = ".sh"
// add ./ to force locality
preamble = "./"
}
if _, err := os.Stat(filepath.Join(location, "post_install"+extension)); err == nil {
t.Logger("Installing drivers")
ok := MessageBox("Installing drivers", "We are about to install some drivers needed to use Arduino/Genuino boards\nDo you want to continue?")
if ok == OK_PRESSED {
os.Chdir(location)
t.Logger(preamble + "post_install" + extension)
oscmd := exec.Command(preamble + "post_install" + extension)
if runtime.GOOS != "linux" {
// spawning a shell could be the only way to let the user type his password
TellCommandNotToSpawnShell(oscmd)
}
err = oscmd.Run()
return err
} else {
return errors.New("Could not install drivers")
}
}
return nil
}

func makeExecutable(location string) error {
location = path.Join(location, "bin")
files, err := ioutil.ReadDir(location)
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp