// SpecPath returns the path to the spec relative to the server package.
// If the spec is remote keep this absolute location.
//
// If spec is not relative to server (e.g. lives on a different drive on windows),
// then the resolved path is absolute.
//
// This method is used by templates, e.g. with {{ .SpecPath }}
//
// Errors cases are prevented by calling CheckOpts beforehand.
SpecPath returns the path to the spec relative to the server package.
If the spec is remote keep this absolute location.

If spec is not relative to server ,
then the resolved path is absolute.

This method is used by templates, e.g. with {{ .SpecPath }}

Errors cases are prevented by calling CheckOpts beforehand.
// SpecPath returns the path to the spec relative to the server package . // If the spec is remote keep this absolute location . // // If spec is not relative to server ( e . g . lives on a different drive on windows ) // then the resolved path is absolute . // // This method is used by templates e . g . with {{ . SpecPath }} // // Errors cases are prevented by calling CheckOpts beforehand .
func (g *GenOpts) SpecPath() string {
	if strings.HasPrefix(g.Spec, "http://") || strings.HasPrefix(g.Spec, "https://") {
		return g.Spec
	}
	specAbs, _ := filepath.Abs(g.Spec)
	var tgt string
	if g.Target == "" {
		tgt = "." 
	} else {
		tgt = g.Target
	}
	tgtAbs, _ := filepath.Abs(tgt)
	srvPkg := filepath.FromSlash(g.LanguageOpts.ManglePackagePath(g.ServerPackage, "server"))
	srvAbs := filepath.Join(tgtAbs, srvPkg)
	specRel, err := filepath.Rel(srvAbs, specAbs)
	if err != nil {
		return specAbs
	}
	return specRel
}
func ( g * GenOpts ) SpecPath ( ) string { if strings . HasPrefix ( g . Spec , " " ) || strings . HasPrefix ( g . Spec , " " ) { return g . Spec } specAbs , _ := filepath . Abs ( g . Spec ) var tgt string if g . Target == " " { tgt = " " } else { tgt = g . Target } tgtAbs , _ := filepath . Abs ( tgt ) srvPkg := filepath . FromSlash ( g . LanguageOpts . ManglePackagePath ( g . ServerPackage , " " ) ) srvAbs := filepath . Join ( tgtAbs , srvPkg ) specRel , err := filepath . Rel ( srvAbs , specAbs ) if err != nil { return specAbs } return specRel }
SpecPath returns the path to the spec relative to the server package.
SpecPath returns the path to the spec relative to the server package .
// Local specifications // That's for windows