You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Make FileAccess and DirAccess classes reference counted.
This commit is contained in:
@@ -382,8 +382,8 @@ bool ShaderRD::_load_from_cache(Version *p_version) {
|
||||
String sha1 = _version_get_sha1(p_version);
|
||||
String path = shader_cache_dir.plus_file(name).plus_file(base_sha256).plus_file(sha1) + ".cache";
|
||||
|
||||
FileAccessRef f = FileAccess::open(path, FileAccess::READ);
|
||||
if (!f) {
|
||||
Ref<FileAccess> f = FileAccess::open(path, FileAccess::READ);
|
||||
if (f.is_null()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -445,8 +445,8 @@ void ShaderRD::_save_to_cache(Version *p_version) {
|
||||
String sha1 = _version_get_sha1(p_version);
|
||||
String path = shader_cache_dir.plus_file(name).plus_file(base_sha256).plus_file(sha1) + ".cache";
|
||||
|
||||
FileAccessRef f = FileAccess::open(path, FileAccess::WRITE);
|
||||
ERR_FAIL_COND(!f);
|
||||
Ref<FileAccess> f = FileAccess::open(path, FileAccess::WRITE);
|
||||
ERR_FAIL_COND(f.is_null());
|
||||
f->store_buffer((const uint8_t *)shader_file_header, 4);
|
||||
f->store_32(cache_file_version); //file version
|
||||
uint32_t variant_count = variant_defines.size();
|
||||
@@ -456,8 +456,6 @@ void ShaderRD::_save_to_cache(Version *p_version) {
|
||||
f->store_32(p_version->variant_data[i].size()); //stage count
|
||||
f->store_buffer(p_version->variant_data[i].ptr(), p_version->variant_data[i].size());
|
||||
}
|
||||
|
||||
f->close();
|
||||
}
|
||||
|
||||
void ShaderRD::_compile_version(Version *p_version) {
|
||||
@@ -652,8 +650,8 @@ void ShaderRD::initialize(const Vector<String> &p_variant_defines, const String
|
||||
|
||||
base_sha256 = hash_build.as_string().sha256_text();
|
||||
|
||||
DirAccessRef d = DirAccess::open(shader_cache_dir);
|
||||
ERR_FAIL_COND(!d);
|
||||
Ref<DirAccess> d = DirAccess::open(shader_cache_dir);
|
||||
ERR_FAIL_COND(d.is_null());
|
||||
if (d->change_dir(name) != OK) {
|
||||
Error err = d->make_dir(name);
|
||||
ERR_FAIL_COND(err != OK);
|
||||
|
||||
Reference in New Issue
Block a user