Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #3

Merged
merged 4 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading