]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blame - vendor/github.com/hashicorp/go-getter/get_file.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / go-getter / get_file.go
CommitLineData
bae9f6d2
JC
1package getter
2
3import (
4 "net/url"
5 "os"
6)
7
8// FileGetter is a Getter implementation that will download a module from
9// a file scheme.
10type FileGetter struct {
107c1cdb
ND
11 getter
12
13 // Copy, if set to true, will copy data instead of using a symlink. If
14 // false, attempts to symlink to speed up the operation and to lower the
15 // disk space usage. If the symlink fails, may attempt to copy on windows.
bae9f6d2
JC
16 Copy bool
17}
18
19func (g *FileGetter) ClientMode(u *url.URL) (ClientMode, error) {
20 path := u.Path
21 if u.RawPath != "" {
22 path = u.RawPath
23 }
24
25 fi, err := os.Stat(path)
26 if err != nil {
27 return 0, err
28 }
29
30 // Check if the source is a directory.
31 if fi.IsDir() {
32 return ClientModeDir, nil
33 }
34
35 return ClientModeFile, nil
36}