diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-12-05 22:30:10 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-12-11 09:39:54 +1100 |
commit | e0ff46fe53503d74fc63c90fc5ddc4d9468b60d5 (patch) | |
tree | 137f8360a1416b08cc6c327ba47b07a4670366d6 /pkg/commands/os.go | |
parent | cce6f405a5643ed46a6bc0b9fd7cf132c915c9f3 (diff) |
more work on rebasing including visual indicators
Diffstat (limited to 'pkg/commands/os.go')
-rw-r--r-- | pkg/commands/os.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/commands/os.go b/pkg/commands/os.go index 6b28a69bb..829034eb8 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -202,3 +202,14 @@ func (c *OSCommand) CreateTempFile(filename, content string) (string, error) { func (c *OSCommand) RemoveFile(filename string) error { return os.Remove(filename) } + +// FileExists checks whether a file exists at the specified path +func (c *OSCommand) FileExists(path string) (bool, error) { + if _, err := os.Stat(path); err != nil { + if os.IsNotExist(err) { + return false, nil + } + return false, err + } + return true, nil +} |