diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-10 01:48:43 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-10 01:48:43 +0200 |
commit | 6f1d1e00a7c615209cf6b25e314d033bda3b5d09 (patch) | |
tree | 51492dae8b010a25a2116e5c8cbeadeef1fa3726 /utils/fs/os.go | |
parent | e013b297b14949aadaec66deaedc130e86c30afb (diff) | |
download | go-git-6f1d1e00a7c615209cf6b25e314d033bda3b5d09.tar.gz |
storage: filesystem ref storage, and not not exists file handling
Diffstat (limited to 'utils/fs/os.go')
-rw-r--r-- | utils/fs/os.go | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/utils/fs/os.go b/utils/fs/os.go index 1ae4204..51af921 100644 --- a/utils/fs/os.go +++ b/utils/fs/os.go @@ -36,7 +36,7 @@ func (fs *OS) Create(filename string) (File, error) { } return &OSFile{ - BaseFile: BaseFile{filename: fullpath}, + BaseFile: BaseFile{filename: filename}, file: f, }, nil } @@ -60,14 +60,8 @@ func (fs *OS) ReadDir(path string) ([]FileInfo, error) { } func (fs *OS) Rename(from, to string) error { - if !filepath.IsAbs(from) { - from = fs.Join(fs.RootDir, from) - } - - if !filepath.IsAbs(to) { - to = fs.Join(fs.RootDir, to) - } - + from = fs.Join(fs.RootDir, from) + to = fs.Join(fs.RootDir, to) return os.Rename(from, to) } @@ -80,7 +74,7 @@ func (fs *OS) Open(filename string) (File, error) { } return &OSFile{ - BaseFile: BaseFile{filename: fullpath}, + BaseFile: BaseFile{filename: filename}, file: f, }, nil } |