github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/configuration/config_disk_persistor_win.go (about)

     1  // +build windows
     2  
     3  package configuration
     4  
     5  import (
     6  	"os"
     7  	"path/filepath"
     8  	"syscall"
     9  )
    10  
    11  func (dp DiskPersistor) makeDirectory() error {
    12  	dir := filepath.Dir(dp.filePath)
    13  
    14  	err := os.MkdirAll(dir, dirPermissions)
    15  	if err != nil {
    16  		return err
    17  	}
    18  
    19  	p, err := syscall.UTF16PtrFromString(dir)
    20  	if err != nil {
    21  		return err
    22  	}
    23  
    24  	attrs, err := syscall.GetFileAttributes(p)
    25  	if err != nil {
    26  		return err
    27  	}
    28  
    29  	return syscall.SetFileAttributes(p, attrs|syscall.FILE_ATTRIBUTE_HIDDEN)
    30  }