Переглянути джерело

Merge pull request #280 from GWRon/feat_filetime

[Brl.FileSystem] Add filetime getter/setter utilizing SDateTime
Brucey 2 роки тому
батько
коміт
6cfd9e29bc
1 змінених файлів з 24 додано та 0 видалено
  1. 24 0
      filesystem.mod/filesystem.bmx

+ 24 - 0
filesystem.mod/filesystem.bmx

@@ -284,6 +284,30 @@ Function SetFileTime( path:String, time:Long, timeType:Int=FILETIME_MODIFIED)
 	End If
 End Function
 
+Rem
+bbdoc: Sets the file modified or last accessed time.
+about: @dateTime is the basic DateTime struct defined in pub.stdc .
+End Rem
+Function SetFileTime( path:String, dateTime:SDateTime, timeType:Int=FILETIME_MODIFIED)
+	SetFileTime(path, dateTime.ToEpochSecs(), timeType) 
+End Function
+
+Rem
+bbdoc: Gets file time
+returns: The time the file at @path was last modified as SDatetime struct.
+End Rem
+Function FileDateTime:SDateTime( path$, timetype:Int=FILETIME_MODIFIED )
+	Return SDateTime.FromEpoch( FileTime(path, timetype) )
+End Function
+
+Rem
+bbdoc: Sets the file modified or last accessed time.
+about: @dateTime is the basic DateTime struct defined in pub.stdc .
+End Rem
+Function SetFileDateTime( path:String, dateTime:SDateTime, timeType:Int=FILETIME_MODIFIED)
+	SetFileTime(path, dateTime.ToEpochSecs(), timeType) 
+End Function
+
 Rem
 bbdoc: Gets the file size
 returns: The size, in bytes, of the file at @path, or -1 if the file does not exist