Petr
Petr

Reputation: 63359

How to get file access times in Haskell (cross-platform)?

I'd like to read file access times in a portable way. I found accessTime in System.Posix.Files, but it's POSIX only. Is there a portable, cross-platform way that would work both on Windows and POSIX systems?

Upvotes: 2

Views: 1236

Answers (4)

Jens Petersen
Jens Petersen

Reputation: 191

As of directory-1.2.3 there is now System.Directory.getAccessTime.

Upvotes: 0

Michael Snoyman
Michael Snoyman

Reputation: 31305

You can use unix-compat to get both Windows and POSIX support for a lot of the functionality in the unix package.

Upvotes: 2

augustss
augustss

Reputation: 23014

How about System.Directory.getModificationTime for modification time? For access time I'm not sure there is a portable way.

Upvotes: 6

Ilya Rezvov
Ilya Rezvov

Reputation: 944

On Windows you can use System.Win32.getFileTime function, second time - is last access time. How i know - no crossplatform way for this task.

Upvotes: 4

Related Questions