github.com/hoffie/larasync@v0.0.0-20151025221940-0384d2bddcef/repository/managementDirectory_windows.go (about) 1 // +build windows 2 3 package repository 4 5 import ( 6 "fmt" 7 8 "github.com/hoffie/larasync/helpers/path" 9 ) 10 11 // hideManagementDirectory tries to mark the directory as hidden. 12 // If this fails returns an error. 13 func (md *managementDirectory) hideManagementDirectory() error { 14 return path.Hide(md.getDir()) 15 } 16 17 // afterRootInitialization can be used as a hook for system 18 // specific functionality which is needed after the Root 19 // management directory has been initialized. 20 // On windows this tries to mark the management directory 21 // folder as hidden. This will however fail silently if it 22 // does not work. It is not necessary for the overall system 23 // functionality for this to work. 24 func (md *managementDirectory) afterRootInitialization() error { 25 err := md.hideManagementDirectory() 26 // Explicitly ignoring the error code here. It is ok if it 27 // fails. Just log a warning. 28 if err != nil { 29 Log.Warn( 30 fmt.Sprintf( 31 "Error while trying to hide management directory. %s", 32 err.Error(), 33 ), 34 ) 35 } 36 return nil 37 }