Skip to content

Commit

Permalink
Add in .modify_time(), .access_time() and .change_time() methods for …
Browse files Browse the repository at this point in the history
…File
  • Loading branch information
Whiteknight committed Dec 24, 2011
1 parent e51f72a commit b928945
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/filesystem/Constants.winxed
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
constants defined in stat.pasm in the Parrot standard library,
inexplicably.
*/
// For the stat opcode
const int STAT_ISREG = 0x8000;
const int STAT_ISDIR = 0x4000;

// For the OS.stat method
const int STAT_SIZE = 7;
const int STAT_ACCESS_TIME = 8;
const int STAT_MODIFY_TIME = 9;
const int STAT_CHANGE_TIME = 10;

21 changes: 21 additions & 0 deletions src/filesystem/File.winxed
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,25 @@ class Rosella.FileSystem.File : Rosella.FileSystem.Entry
var s = os.stat(self.path);
return s[STAT_SIZE];
}

function modify_time()
{
var os = Rosella.FileSystem.get_os_pmc();
var s = os.stat(self.path);
return s[STAT_MODIFY_TIME];
}

function access_time()
{
var os = Rosella.FileSystem.get_os_pmc();
var s = os.stat(self.path);
return s[STAT_ACCESS_TIME];
}

function change_time()
{
var os = Rosella.FileSystem.get_os_pmc();
var s = os.stat(self.path);
return s[STAT_CHANGE_TIME];
}
}

0 comments on commit b928945

Please sign in to comment.