mirror of
https://github.com/laravel-ls/uri
synced 2026-07-04 08:23:43 +02:00
uri.go: add URI.HasFilename()
This commit is contained in:
parent
9ec02972e6
commit
11ab527f6c
1 changed files with 5 additions and 0 deletions
5
uri.go
5
uri.go
|
|
@ -53,6 +53,11 @@ func (u URI) Filename() string {
|
||||||
return filepath.FromSlash(filename)
|
return filepath.FromSlash(filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns true if URI has a valid filename
|
||||||
|
func (u URI) HasFilename() bool {
|
||||||
|
return IsFileURI(string(u))
|
||||||
|
}
|
||||||
|
|
||||||
func IsFileURI(uri string) bool {
|
func IsFileURI(uri string) bool {
|
||||||
return strings.HasPrefix(uri, FileScheme+hierPart)
|
return strings.HasPrefix(uri, FileScheme+hierPart)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue