From f584add04c66e9fbc0b28f95f8ccd9c7c322a891 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Fri, 20 Dec 2024 14:14:00 -0500 Subject: [PATCH] file comparators too --- .../lib/Standard/AWS/0.0.0-dev/src/S3/S3_File.enso | 10 +++++++++- .../Base/0.0.0-dev/src/Enso_Cloud/Enso_File.enso | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/distribution/lib/Standard/AWS/0.0.0-dev/src/S3/S3_File.enso b/distribution/lib/Standard/AWS/0.0.0-dev/src/S3/S3_File.enso index 890b1c8cf659..e985570a3352 100644 --- a/distribution/lib/Standard/AWS/0.0.0-dev/src/S3/S3_File.enso +++ b/distribution/lib/Standard/AWS/0.0.0-dev/src/S3/S3_File.enso @@ -187,7 +187,7 @@ type S3_File S3_File.Value (S3_Path.Value bucket key) self.credentials files = pair.second . map key-> S3_File.Value (S3_Path.Value bucket key) self.credentials - (sub_folders + files) . sort on=(x-> x.s3_path) + (sub_folders + files) . sort ## ALIAS load bytes, open bytes ICON data_input @@ -616,3 +616,11 @@ translate_file_errors related_file result = s3_path = S3_Path.Value error.bucket error.key s3_file = S3_File.Value s3_path related_file.credentials Error.throw (File_Error.Not_Found s3_file) + +type S3_File_Comparator + compare x y = Ordering.compare x.s3_path y.s3_path + + hash x = S3_File_Comparator.hash_builtin x + hash_builtin x = @Builtin_Method "Default_Comparator.hash_builtin" + +Comparable.from that:S3_File = Comparable.new that S3_File_Comparator diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Enso_Cloud/Enso_File.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Enso_Cloud/Enso_File.enso index 3dadc08d925e..4539d172acea 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Enso_Cloud/Enso_File.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Enso_Cloud/Enso_File.enso @@ -448,7 +448,7 @@ type Enso_File file = Enso_File.Value (self.enso_path.resolve asset.name) Asset_Cache.update file asset file - results.sort on=.enso_path + results.sort ## GROUP Output ICON folder_add @@ -584,3 +584,11 @@ File_Like.from (that : Enso_File) = File_Like.Value that ## PRIVATE Writable_File.from (that : Enso_File) = if Data_Link.is_data_link that then Data_Link_Helpers.interpret_data_link_as_writable_file that else Writable_File.Value that Enso_File_Write_Strategy.instance + +type Enso_File_Comparator + compare x y = Ordering.compare x.enso_path y.enso_path + + hash x = Enso_File_Comparator.hash_builtin x + hash_builtin x = @Builtin_Method "Default_Comparator.hash_builtin" + +Comparable.from that:Enso_File = Comparable.new that Enso_File_Comparator