Explorar o código

Added archive entry FileType() method.

Brucey %!s(int64=3) %!d(string=hai) anos
pai
achega
75479cc378
Modificáronse 4 ficheiros con 13 adicións e 0 borrados
  1. 1 0
      core.mod/common.bmx
  2. 7 0
      core.mod/core.bmx
  3. 4 0
      core.mod/glue.c
  4. 1 0
      zip.mod/examples/example_01.bmx

+ 1 - 0
core.mod/common.bmx

@@ -107,6 +107,7 @@ Extern
 	Function bmx_libarchive_archive_entry_set_birthtime(handle:Byte Ptr, btime:Long, nanoseconds:Long)
 	Function bmx_libarchive_archive_entry_unset_birthtime(handle:Byte Ptr)
 	Function bmx_libarchive_archive_entry_unset_ctime(handle:Byte Ptr)
+	Function bmx_libarchive_archive_entry_filetype:EArchiveFileType(handle:Byte Ptr)
 
 	Function archive_error_string:Byte Ptr(handle:Byte Ptr)
 End Extern

+ 7 - 0
core.mod/core.bmx

@@ -878,6 +878,13 @@ Type TArchiveEntry
 		bmx_libarchive_archive_entry_unset_ctime(entryPtr)
 	End Method
 
+	Rem
+	bbdoc: Returns the entry file type.
+	End Rem
+	Method FileType:EArchiveFileType()
+		Return bmx_libarchive_archive_entry_filetype(entryPtr)
+	End Method
+
 	Rem
 	bbdoc: Destination of the hardlink.
 	End Rem

+ 4 - 0
core.mod/glue.c

@@ -496,3 +496,7 @@ void bmx_libarchive_archive_entry_unset_birthtime(struct archive_entry * entry)
 void bmx_libarchive_archive_entry_unset_ctime(struct archive_entry * entry) {
 	archive_entry_unset_ctime(entry);
 }
+
+int bmx_libarchive_archive_entry_filetype(struct archive_entry * entry) {
+	return archive_entry_filetype(entry);
+}

+ 1 - 0
zip.mod/examples/example_01.bmx

@@ -25,6 +25,7 @@ ra.Open("data.zip")
 While ra.ReadNextHeader(entry) = ARCHIVE_OK
 	Print "File : " + entry.Pathname()
 	Print "Size : " + entry.Size()
+	Print "Type : " + entry.FileType().ToString()
 	Local s:String = LoadText(ra.DataStream())
 	Print "String size   : " + s.Length
 	Print "First n chars : " + s[0..17]