Compare commits
No commits in common. "23359f2fef04640bc236e41cf760060049401901" and "dac8c577dd16bfe0157259dbad9f6de8c0787c7a" have entirely different histories.
23359f2fef
...
dac8c577dd
@ -5,7 +5,7 @@
|
||||
|
||||
## Recursively creates virtual file systems.
|
||||
static func create_meta_accessor(file_accessors:Array[VFileAccess])->VFileAccess:
|
||||
var vfiler := VFileAccess.new("")
|
||||
var vfiler := VFileAccess.new()
|
||||
|
||||
vfiler._get_stuff = func()->Variant: return file_accessors
|
||||
|
||||
|
18
vfs.gd
18
vfs.gd
@ -101,24 +101,6 @@ func load_supported(path:String, ext_override:String = "")->Variant:
|
||||
return result
|
||||
|
||||
|
||||
## Like load_supported, but expects [param path] to not have an extension.
|
||||
## Instead, [param extensions] can contain multiple extensions, which will be
|
||||
## appended and checked to exist. This allows for prioritizing one format
|
||||
## over another or loosely defining a file id and allowing the engine to
|
||||
## find a first match.
|
||||
func load_any_supported(base_path:String, extensions:Array[String] = [])->Variant:
|
||||
var _append_ext := func _append_ext(ext:String)->String:
|
||||
return (base_path + ext) \
|
||||
if ext.begins_with(".") \
|
||||
else (base_path + "." + ext)
|
||||
var try_paths:Array = extensions.map(_append_ext)
|
||||
for path:String in try_paths:
|
||||
if not file_exists(path): continue
|
||||
return load_supported(path)
|
||||
push_error("Could not find any file for '%s'.%s!" % [base_path, extensions])
|
||||
return null
|
||||
|
||||
|
||||
## [param parse] Callable(buffer:PackedByteArray)->Variant
|
||||
func load_and_parse(path:String, parse:Callable)->Variant:
|
||||
var abs_path:String = get_absolute_path(path)
|
||||
|
@ -30,7 +30,7 @@ static func load_mp3(buffer:PackedByteArray)->AudioStreamMP3:
|
||||
|
||||
static func load_ogg(buffer:PackedByteArray)->AudioStreamOggVorbis:
|
||||
var sfx := AudioStreamOggVorbis.new()
|
||||
sfx.load_from_buffer(buffer)
|
||||
sfx.data = buffer
|
||||
return sfx
|
||||
|
||||
static func load_txt(buffer:PackedByteArray)->String:
|
||||
|
Loading…
Reference in New Issue
Block a user