From 0d79cac1ab88d096c65cf4348f56516ffb102e6b Mon Sep 17 00:00:00 2001 From: Lyaaaaaaaaaaaaaaa Date: Tue, 6 Aug 2024 16:31:01 +0200 Subject: [PATCH 1/4] added random space to tests --- tests/test_dir_utils.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_dir_utils.gd b/tests/test_dir_utils.gd index c077126..987ae58 100644 --- a/tests/test_dir_utils.gd +++ b/tests/test_dir_utils.gd @@ -18,7 +18,7 @@ #-- #-- - 10/10/2023 Lyaaaaa #-- - Upgraded to Godot4 -#-- - Replaced dir_util var by call of Dir_Utils directly. +#-- - Replaced dir_util var by call of Dir_Utils directly. #-- - test_create_dir_recursive calls Dir_Utils's delete instead of DirAccess #-- remove. #-- From 947c55ff6b243cdc8a45d5ba3809f71ac363cf56 Mon Sep 17 00:00:00 2001 From: Lyaaaaaaaaaaaaaaa Date: Wed, 7 Aug 2024 10:10:13 +0200 Subject: [PATCH 2/4] remove whitespace from project name --- project.godot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.godot b/project.godot index 36c069d..1c44147 100644 --- a/project.godot +++ b/project.godot @@ -10,7 +10,7 @@ config_version=5 [application] -config/name="Godot Dir Utils" +config/name="Godot_Dir_Utils" config/features=PackedStringArray("4.2", "GL Compatibility") config/icon="res://icon.svg" From 9b6da6cecdffb006ad34845036edb3b956a504e8 Mon Sep 17 00:00:00 2001 From: Lyaaaaaaaaaaaaaaa Date: Wed, 7 Aug 2024 10:10:57 +0200 Subject: [PATCH 3/4] Added comment in Anticipated changes for DirUtils --- src/DirUtils.gd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/DirUtils.gd b/src/DirUtils.gd index f3181d6..c95ac43 100644 --- a/src/DirUtils.gd +++ b/src/DirUtils.gd @@ -8,6 +8,7 @@ #-- #-- Anticipated changes: #-- - Rewrite get_files_names to use the very simple get_files_at method. +#-- - Update delete_dir to call delete_dir if it finds a dir inside the path. #-- #-- Portability issue: #-- - All the path have to be absolute (res:// and user:// work though)! @@ -15,6 +16,7 @@ #-- Changelog: #-- - 06/08/2024 Lyaaaaa #-- - Renamed cut_file into move_file to be more explicit. +#-- #------------------------------------------------------------------------------ @tool class_name Dir_Utils From d6959c7e6378cd1c389808f90b54e5b2ddef5168 Mon Sep 17 00:00:00 2001 From: Lyaaaaaaaaaaaaaaa Date: Wed, 7 Aug 2024 10:16:01 +0200 Subject: [PATCH 4/4] Updated units test to fix delete and get_folder_size failing tests - Updated test_delete to delete all the files declared in files (forgot to update it when added a fourth file in files var). - Updated test_get_folder_size to correctly do its job and to clean his mess. --- tests/test_dir_utils.gd | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/test_dir_utils.gd b/tests/test_dir_utils.gd index 987ae58..8f95a09 100644 --- a/tests/test_dir_utils.gd +++ b/tests/test_dir_utils.gd @@ -18,7 +18,7 @@ #-- #-- - 10/10/2023 Lyaaaaa #-- - Upgraded to Godot4 -#-- - Replaced dir_util var by call of Dir_Utils directly. +#-- - Replaced dir_util var by call of Dir_Utils directly. #-- - test_create_dir_recursive calls Dir_Utils's delete instead of DirAccess #-- remove. #-- @@ -35,6 +35,11 @@ #-- #-- - 06/08/2024 Lyaaaaa #-- - Renamed cut_file into move_file. +#-- +#-- - 07/08/2024 Lyaaaaa +#-- - Updated test_delete to delete all the files declared in files +#-- (forgot to update it when added a fourth file in files var). +#-- - Updated test_get_folder_size to correctly do its job and to clean his mess. #------------------------------------------------------------------------------ extends GutTest @@ -96,6 +101,7 @@ func test_delete(): Dir_Utils.delete(test_folder + sub_folders[0] + files[1]) Dir_Utils.delete(test_folder + sub_folders[0] + files[2]) + Dir_Utils.delete(test_folder + sub_folders[0] + files[3]) result = Dir_Utils.delete((test_folder + sub_folders[0])) assert_true(result, "Did delete return true for deleting a folder.") @@ -167,7 +173,7 @@ func test_delete_dir(): func test_get_folder_size(): - var size = Dir_Utils.get_folder_size(test_folder) + var size = Dir_Utils.get_folder_size(test_folder + sub_folders[0]) var msg = "get folder size returns an int" assert_typeof(size, TYPE_INT, msg) @@ -184,6 +190,8 @@ func test_is_empty() -> void: assert_true(Dir_Utils.is_empty(path)) assert_false(Dir_Utils.is_empty(test_folder.path_join(sub_folders[0]))) + Dir_Utils.delete_dir(path) + func test_get_file_name_with_extension() -> void: var path = test_folder.path_join(sub_folders[0].path_join(files[2]))