gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

symlink.go (2037B)


      1 // Copyright © 2018 Steve Francia <spf@spf13.com>.
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 // http://www.apache.org/licenses/LICENSE-2.0
      7 //
      8 // Unless required by applicable law or agreed to in writing, software
      9 // distributed under the License is distributed on an "AS IS" BASIS,
     10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     11 // See the License for the specific language governing permissions and
     12 // limitations under the License.
     13 
     14 package afero
     15 
     16 import (
     17 	"errors"
     18 )
     19 
     20 // Symlinker is an optional interface in Afero. It is only implemented by the
     21 // filesystems saying so.
     22 // It indicates support for 3 symlink related interfaces that implement the
     23 // behaviors of the os methods:
     24 //   - Lstat
     25 //   - Symlink, and
     26 //   - Readlink
     27 type Symlinker interface {
     28 	Lstater
     29 	Linker
     30 	LinkReader
     31 }
     32 
     33 // Linker is an optional interface in Afero. It is only implemented by the
     34 // filesystems saying so.
     35 // It will call Symlink if the filesystem itself is, or it delegates to, the os filesystem,
     36 // or the filesystem otherwise supports Symlink's.
     37 type Linker interface {
     38 	SymlinkIfPossible(oldname, newname string) error
     39 }
     40 
     41 // ErrNoSymlink is the error that will be wrapped in an os.LinkError if a file system
     42 // does not support Symlink's either directly or through its delegated filesystem.
     43 // As expressed by support for the Linker interface.
     44 var ErrNoSymlink = errors.New("symlink not supported")
     45 
     46 // LinkReader is an optional interface in Afero. It is only implemented by the
     47 // filesystems saying so.
     48 type LinkReader interface {
     49 	ReadlinkIfPossible(name string) (string, error)
     50 }
     51 
     52 // ErrNoReadlink is the error that will be wrapped in an os.Path if a file system
     53 // does not support the readlink operation either directly or through its delegated filesystem.
     54 // As expressed by support for the LinkReader interface.
     55 var ErrNoReadlink = errors.New("readlink not supported")