Refactored a lot of stuff.

Added property lists.
Renamed FileAdapter to FileSystemAdapter.
And more smaller stuff.
This commit is contained in:
2021-08-18 22:03:39 +02:00
parent dc7dc48e9b
commit 18dd6d61fb
22 changed files with 954 additions and 36 deletions

View File

@@ -1,6 +1,6 @@
extends Reference
class_name UIB_FileAdapter
class_name UIB_FilesystemAdapter
class FileEntry:
func _is_folder() -> bool:

View File

@@ -1,11 +1,11 @@
extends UIB_FileAdapter
extends UIB_FilesystemAdapter
class_name UIB_LocalFileAdapter
class_name UIB_LocalFilesystemAdapter
var __dir = Directory.new()
class LocalFileEntry:
extends UIB_FileAdapter.FileEntry
extends UIB_FilesystemAdapter.FileEntry
var path : String
var is_link : bool
@@ -30,6 +30,7 @@ class LocalFileEntry:
if !is_folder:
return []
var dir := Directory.new()
var file := File.new()
if dir.open(path + "/") != OK:
return []
if dir.list_dir_begin(true) != OK:
@@ -59,7 +60,7 @@ class LocalFileEntry:
modified_time = __calc_modified_time()
return modified_time
func _get_parent() -> UIB_FileAdapter.FileEntry:
func _get_parent() -> UIB_FilesystemAdapter.FileEntry:
var parent_path := path.get_base_dir()
if parent_path && parent_path != path:
return LocalFileEntry.new(parent_path, false, true)
@@ -97,7 +98,7 @@ func _get_file(path : String) -> FileEntry:
else:
return null
func _get_root() -> UIB_FileAdapter.FileEntry:
func _get_root() -> UIB_FilesystemAdapter.FileEntry:
return _get_file("/")
func _get_drives() -> Array: