// HomeDir returns path of '~'(in Linux) on Windows,
// it returns error when the variable does not exist.
779356
func HomeDir() (home string, err error) {
	if runtime.GOOS == "windows" {
		home = os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH")
		if home == "" {
			home = os.Getenv("USERPROFILE")
		}
	} else {
		home = os.Getenv("HOME")
	}

	if len(home) == 0 {
		return "", errors.New("Cannot specify home directory because it's empty")
	}

	return home, nil
}
1094423
func GodelHomePath() (string, error) {
	// check the environment variable
	if godelHomeDir := os.Getenv(godelHomeEnvVar); godelHomeDir != "" {
		return godelHomeDir, nil
	}
	// if not present, create from home directory
	if userHomeDir := os.Getenv("HOME"); userHomeDir != "" {
		return path.Join(userHomeDir, defaultGodelHome), nil
	}
	return "", fmt.Errorf("failed to get %s home directory", AppName)
}
17876
func ReadDir(dirname string) ([]os.FileInfo, error) {
	list, err := ioutil_base.ReadDir(dirname)
	if err != nil {
		return nil, errors.Wrapf(err, "failed to read dir %q", dirname)
	}

	return list, nil
}
1023374
func (f *FilesystemIO) ReadDir(dirname string) ([]os.FileInfo, error) {
	return ioutil.ReadDir(dirname)
}
580924
func (fs *FS) ReadDir(path string) ([]os.FileInfo, error) {
	return fs.Filesystem.ReadDir(fs.PrefixPath(path))
}
203941
func (s *FolderStorage) dir(key string) string {
	sum := md5.Sum([]byte(key))
	return filepath.Join(s.StorageDir, hex.EncodeToString(sum[:]))
}
880478
func MkDir(dirpath string) error {
	if PathExists(dirpath) {
		return nil
	}

	err := os.MkdirAll(dirpath, 0755)
	if err != nil {
		log.Println("Error creating directory")
		log.Println(err)
		return err
	}

	return nil
}
609139
func ConfigDir() string {
	configHome := filepath.Join(os.Getenv("HOME"), DefaultConfigDir)
	if xdg := os.Getenv("XDG_CONFIG_HOME"); len(xdg) > 0 {
		configHome = xdg
	}

	return filepath.Join(configHome, ConfigFolder)
}
472761
func Dir() (dir string, err error) {
	path, err := Path()
	if err != nil {
		return
	}
	dir, _ = filepath.Split(path)
	return
}
29814
func (c *C) MkDir() string {
	path := c.tempDir.newPath()
	if err := os.Mkdir(path, 0700); err != nil {
		panic(fmt.Sprintf("Couldn't create temporary directory %s: %s", path, err.Error()))
	}
	return path
}
1177280
func (s *CreateUserInput) SetHomeDirectory(v string) *CreateUserInput {
	s.HomeDirectory = &v
	return s
}
635160
func (mount *MountInfo) MakeDir(path string, mode uint32) error {
	cPath := C.CString(path)
	defer C.free(unsafe.Pointer(cPath))

	ret := C.ceph_mkdir(mount.mount, cPath, C.mode_t(mode))
	if ret != 0 {
		log.Errorf("MakeDir: Failed to make directory %s", path)
		return cephError(ret)
	}
	return nil
}
1154224
func LocalDir(p string) string {
	homeDir := ServiceDHome()
	return path.Join(homeDir, p)
}
155824
func TempDir(p string) string {
	var tmp string

	if user, err := user.Current(); err == nil {
		tmp = path.Join(os.TempDir(), fmt.Sprintf("serviced-%s", user.Username), p)
	} else {
		tmp = path.Join(os.TempDir(), fmt.Sprintf("serviced"), p)
		glog.Warningf("Defaulting home to %s", tmp)
	}

	return tmp
}
103489
func SecretsDir() string {
	secrets.once.Do(func() {
		home, err := homedir.Dir()
		if err != nil {
			fmt.Fprintf(os.Stderr, "Can't resolve $HOME: %s", err)
		} else {
			secrets.val = filepath.Join(home, ".config", "chrome_infra", "auth")
		}
	})
	return secrets.val
}
15414
func (p Proc) RootDir() (string, error) {
	rdir, err := os.Readlink(p.path("root"))
	if os.IsNotExist(err) {
		return "", nil
	}

	return rdir, err
}
906852
func (h *fs) ReadDir(path string) ([]os.FileInfo, error) {
	fis, err := ioutil.ReadDir(path)
	if runtime.GOOS == "windows" && err == nil {
		h.enrichFileInfos(path, fis)
	}
	return fis, err
}