forked from ebhomengo/niki
1
0
Fork 0
niki/vendor/github.com/go-openapi/spec/normalizer_nonwindows.go

72 lines
1.2 KiB
Go
Raw Normal View History

2024-05-14 13:07:09 +00:00
//go:build !windows
// +build !windows
// Copyright 2015 go-swagger maintainers
2024-05-14 13:07:09 +00:00
//
2024-05-14 13:07:09 +00:00
// Licensed under the Apache License, Version 2.0 (the "License");
2024-05-14 13:07:09 +00:00
// you may not use this file except in compliance with the License.
2024-05-14 13:07:09 +00:00
// You may obtain a copy of the License at
2024-05-14 13:07:09 +00:00
//
2024-05-14 13:07:09 +00:00
// http://www.apache.org/licenses/LICENSE-2.0
2024-05-14 13:07:09 +00:00
//
2024-05-14 13:07:09 +00:00
// Unless required by applicable law or agreed to in writing, software
2024-05-14 13:07:09 +00:00
// distributed under the License is distributed on an "AS IS" BASIS,
2024-05-14 13:07:09 +00:00
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2024-05-14 13:07:09 +00:00
// See the License for the specific language governing permissions and
2024-05-14 13:07:09 +00:00
// limitations under the License.
package spec
import (
"net/url"
"path/filepath"
)
// absPath makes a file path absolute and compatible with a URI path component.
2024-05-14 13:07:09 +00:00
//
2024-05-14 13:07:09 +00:00
// The parameter must be a path, not an URI.
2024-05-14 13:07:09 +00:00
func absPath(in string) string {
2024-05-14 13:07:09 +00:00
anchored, err := filepath.Abs(in)
2024-05-14 13:07:09 +00:00
if err != nil {
2024-05-14 13:07:09 +00:00
specLogger.Printf("warning: could not resolve current working directory: %v", err)
2024-05-14 13:07:09 +00:00
return in
2024-05-14 13:07:09 +00:00
}
2024-05-14 13:07:09 +00:00
return anchored
2024-05-14 13:07:09 +00:00
}
func repairURI(in string) (*url.URL, string) {
2024-05-14 13:07:09 +00:00
u, _ := parseURL("")
2024-05-14 13:07:09 +00:00
debugLog("repaired URI: original: %q, repaired: %q", in, "")
2024-05-14 13:07:09 +00:00
return u, ""
2024-05-14 13:07:09 +00:00
}
func fixWindowsURI(_ *url.URL, _ string) {
2024-05-14 13:07:09 +00:00
}