зеркало из https://github.com/golang/tools.git
internal/lsp/source: Use file:///C:/ on Windows file system
URI should be started with file:/// always. Change-Id: I123e577d421de3e85dfec00596fbdb63c2231938 Reviewed-on: https://go-review.googlesource.com/c/153618 Reviewed-by: Rebecca Stambler <rstambler@golang.org> Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Родитель
b620e9ecbe
Коммит
49db546f37
|
@ -12,8 +12,6 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
const fileSchemePrefix = "file://"
|
||||
|
||||
// URI represents the full uri for a file.
|
||||
type URI string
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !windows
|
||||
|
||||
package source
|
||||
|
||||
const fileSchemePrefix = "file://"
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build windows
|
||||
|
||||
package source
|
||||
|
||||
const fileSchemePrefix = "file:///"
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build windows
|
||||
|
||||
package source
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestURIWindows(t *testing.T) {
|
||||
s := `C:\Windows\System32`
|
||||
uri := ToURI(s)
|
||||
if uri != `file:///C:/Windows/System32` {
|
||||
t.Fatalf("ToURI: got %v want %v", uri, s)
|
||||
}
|
||||
f, err := URI(uri).Filename()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if f != s {
|
||||
t.Fatalf("Filename: got %v want %v", f, s)
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче