BGE/Urls
Alias: BGE.Urls
Static Methods
isUrl(path: dynamic): boolean
Whether a path is an http:// or https:// URL rather than a local file.
Parameters
path(dynamic)
Returns
boolean
stripQuery(url: string): string
A URL without its query string or fragment.
Parameters
url(string)
Returns
string
fileExtension(url: string): string
The lowercase file extension of a URL's path (e.g. ".png"), or "" if it has none.
Parameters
url(string)
Returns
string
resolveRelative(baseUrl: string, relativePath: string): string
Resolves a path found inside a downloaded file (e.g. an .obj's mtllib) against that file's URL. "./" and "../" are resolved, and a "//host/path" URL takes the base URL's scheme.
Parameters
baseUrl(string) — the URL of the file the path came fromrelativePath(string) — a relative path, a root-relative path ("/a/b.png") or a full URL
Returns
string— the full URL
normalizePath(urlPath: string): string
Collapses "." and ".." segments in a URL path that starts with "/", never going above the root.
Parameters
urlPath(string)
Returns
string
joinPath(baseDir: string, relativePath: string): string
Resolves a file path written relative to a folder (e.g. an image path inside a map or model file), collapsing "." and ".." segments. A path with its own volume ("pkg:/...") is returned as is.
Parameters
baseDir(string) — the folder, e.g. "pkg:/maps/"; "" leaves the path as isrelativePath(string)
Returns
string
parentFolder(filePath: string): string
The folder a file is in, with a trailing slash: "pkg:/maps/level.tmj" -> "pkg:/maps/".
Parameters
filePath(string)
Returns
string