From 9381acb6a42da653cb6dfd9e610dfccead11aa98 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Wed, 23 Mar 2022 11:08:58 +0200 Subject: Make FileAccess and DirAccess classes reference counted. --- main/main.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'main/main.cpp') diff --git a/main/main.cpp b/main/main.cpp index a99654542a..f20ec94fa5 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -2112,8 +2112,8 @@ bool Main::start() { } { - DirAccessRef da = DirAccess::open(doc_tool_path); - ERR_FAIL_COND_V_MSG(!da, false, "Argument supplied to --doctool must be a valid directory path."); + Ref da = DirAccess::open(doc_tool_path); + ERR_FAIL_COND_V_MSG(da.is_null(), false, "Argument supplied to --doctool must be a valid directory path."); } #ifndef MODULE_MONO_ENABLED @@ -2149,7 +2149,7 @@ bool Main::start() { checked_paths.insert(path); // Create the module documentation directory if it doesn't exist - DirAccessRef da = DirAccess::create_for_path(path); + Ref da = DirAccess::create_for_path(path); err = da->make_dir_recursive(path); ERR_FAIL_COND_V_MSG(err != OK, false, "Error: Can't create directory: " + path + ": " + itos(err)); @@ -2161,7 +2161,7 @@ bool Main::start() { String index_path = doc_tool_path.plus_file("doc/classes"); // Create the main documentation directory if it doesn't exist - DirAccessRef da = DirAccess::create_for_path(index_path); + Ref da = DirAccess::create_for_path(index_path); err = da->make_dir_recursive(index_path); ERR_FAIL_COND_V_MSG(err != OK, false, "Error: Can't create index directory: " + index_path + ": " + itos(err)); @@ -2501,11 +2501,11 @@ bool Main::start() { int sep = local_game_path.rfind("/"); if (sep == -1) { - DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + Ref da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); local_game_path = da->get_current_dir().plus_file(local_game_path); } else { - DirAccessRef da = DirAccess::open(local_game_path.substr(0, sep)); - if (da) { + Ref da = DirAccess::open(local_game_path.substr(0, sep)); + if (da.is_valid()) { local_game_path = da->get_current_dir().plus_file( local_game_path.substr(sep + 1, local_game_path.length())); } -- cgit v1.2.3