// ServiceUnitPath returns the path to the systemd service file for the given
// app name.
190517
func ServiceUnitPath(root string, appName types.ACName) string {
	return filepath.Join(common.Stage1RootfsPath(root), UnitsDir, ServiceUnitName(appName))
}
499437
func (f *Facade) LocateServiceInstance(ctx datastore.Context, serviceID string, instanceID int) (*service.LocationInstance, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.LocateServiceInstance"))
	logger := plog.WithFields(log.Fields{
		"serviceid":  serviceID,
		"instanceid": instanceID,
	})

	svc, err := f.serviceStore.Get(ctx, serviceID)
	if err != nil {
		logger.WithError(err).Debug("Could not look up service")
		return nil, err
	}

	state, err := f.zzk.GetServiceState(ctx, svc.PoolID, svc.ID, instanceID)
	if err != nil {
		logger.WithError(err).Debug("Could not locate service instance")
		return nil, err
	}

	logger.Debug("Found service instance")
	return &service.LocationInstance{
		HostID:      state.HostID,
		HostIP:      state.HostIP,
		ContainerID: state.ContainerID,
	}, nil
}
899116
func (w *Walker) processPath(path string) error {
	defer w.wg.Done()

	names, err := readDirNames(path)
	if err != nil {
		return err
	}

	root := path
	for _, name := range names {
		path = filepath.Join(root, name)
		info, err := os.Lstat(path)
		err = w.walkFunc(path, info, err)

		if err == nil && info.IsDir() {
			w.addJob(path)
		}
		if err != nil && err != filepath.SkipDir {
			return err
		}
	}
	return nil
}
537311
func buildPlatformPath(path string) string {
	if runtime.GOOS == "windows" {
		return fmt.Sprintf("%s\\%s\\%s", os.Getenv("APPDATA"),
			applicationName,
			path)
	}

	var unixConfigDir string
	if xdg := os.Getenv("XDG_CONFIG_HOME"); xdg != "" {
		unixConfigDir = xdg
	} else {
		unixConfigDir = os.Getenv("HOME") + "/.config"
	}

	return fmt.Sprintf("%s/%s/%s", unixConfigDir,
		applicationName,
		path)
}
263531
func AppPath(root string, appName types.ACName) string {
	return filepath.Join(AppsPath(root), appName.String())
}
745715
func (s *SearchService) FilterPath(filterPath ...string) *SearchService {
	s.filterPath = append(s.filterPath, filterPath...)
	return s
}
986512
func (r *EtcdRegistry) legacyUnitStatePath(jobName string) string {
	return r.prefixed(statePrefix, jobName)
}
921923
func ProfilePath() (string, error) {
	if cfgDir := os.Getenv("AZURE_CONFIG_DIR"); cfgDir != "" {
		return filepath.Join(cfgDir, azureProfileJSON), nil
	}
	return homedir.Expand("~/.azure/" + azureProfileJSON)
}
832599
func AssetsPath() string {
	if caddyPath := os.Getenv("CADDYPATH"); caddyPath != "" {
		return caddyPath
	}
	return filepath.Join(userHomeDir(), ".caddy")
}
307598
func (uvm *UtilityVM) GetVSMBUvmPath(hostPath string) (_ string, err error) {
	op := "uvm::GetVSMBUvmPath"
	log := logrus.WithFields(logrus.Fields{
		logfields.UVMID: uvm.id,
		"host-path":     hostPath,
	})
	log.Debug(op + " - Begin Operation")
	defer func() {
		if err != nil {
			log.Data[logrus.ErrorKey] = err
			log.Error(op + " - End Operation - Error")
		} else {
			log.Debug(op + " - End Operation - Success")
		}
	}()

	if hostPath == "" {
		return "", fmt.Errorf("no hostPath passed to GetVSMBUvmPath")
	}
	uvm.m.Lock()
	defer uvm.m.Unlock()
	share, err := uvm.findVSMBShare(hostPath)
	if err != nil {
		return "", err
	}
	path := share.GuestPath()
	return path, nil
}
1150918
func (c *Client) ResolveServicePath(path string, noprefix bool) ([]service.ServiceDetails, error) {
	resolveServiceRequest := ResolveServiceRequest{
		Path: path,
		NoPrefix: noprefix,
	}
	svcs := []service.ServiceDetails{}

	plog.WithFields(logrus.Fields{
                "path": path,
                "noprefix": noprefix,
        }).Info("Trying to find service")

	err := c.call("ResolveServicePath", resolveServiceRequest, &svcs)
        return svcs, err
}
585382
func (d *DeviceMapperDriver) MetadataPath(tenant string) string {
	return filepath.Join(d.MetadataDir(), tenant, "metadata.json")
}
64796
func NewEndpointPath(application, name string) string {
	return fmt.Sprintf(HTTPEndpointPath, application, name)
}
1344178
func (c *Conn) GetUnitProperties(unit string) (map[string]interface{}, error) {
	path := unitPath(unit)
	return c.getProperties(path, "org.freedesktop.systemd1.Unit")
}
1193957
func ServiceLocalFilePath(sv *gen.ServiceMetadata) string {
	return filepath.Join(ServiceLocalDir, ServiceFileName(sv))
}
402176
func UriToPath(uri lsp.DocumentURI) string {
	u, err := url.Parse(string(uri))
	if err != nil {
		return trimFilePrefix(string(uri))
	}
	return u.Path
}
543724
func (s *Sandbox) NetNsPath() string {
	if s.netns == nil || s.netns.Get() == nil ||
		s.netns.Get().symlink == nil {
		if s.infraContainer != nil {
			return fmt.Sprintf("/proc/%v/ns/net", s.infraContainer.State().Pid)
		}
		return ""
	}

	return s.netns.Get().symlink.Name()
}