github.com/searKing/golang/go@v1.2.117/os/match.go (about)

     1  // Copyright 2023 The searKing Author. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package os
     6  
     7  import (
     8  	"runtime"
     9  	"strings"
    10  )
    11  
    12  // hasMeta reports whether path contains any of the magic characters
    13  // recognized by Match.
    14  func hasMeta(path string) bool {
    15  	magicChars := `*?[`
    16  	if runtime.GOOS != "windows" {
    17  		magicChars = `*?[\`
    18  	}
    19  	return strings.ContainsAny(path, magicChars)
    20  }