Skip to content

Commit

Permalink
Merge pull request #3 from LyaaaaaGames/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Lyaaaaaaaaaaaaaaa authored Aug 7, 2024
2 parents 03d676b + d6959c7 commit 4754870
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 2 additions & 0 deletions src/DirUtils.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
#--
#-- 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)!
#--
#-- Changelog:
#-- - 06/08/2024 Lyaaaaa
#-- - Renamed cut_file into move_file to be more explicit.
#--
#------------------------------------------------------------------------------
@tool
class_name Dir_Utils
Expand Down
10 changes: 9 additions & 1 deletion tests/test_dir_utils.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.")
Expand Down Expand Up @@ -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)

Expand All @@ -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]))
Expand Down

0 comments on commit 4754870

Please sign in to comment.