Exemple #1
0
IoObject *IoFile_isDirectory(IoFile *self, IoObject *locals, IoMessage *m)
{
	/*doc File isDirectory
	Returns true if the receiver's path points to a directory, false otherwise.
	*/

	return IOBOOL(self, S_ISDIR(IoFile_statPointer(self, locals, m)->st_mode));
}
Exemple #2
0
IoObject *IoFile_groupId(IoFile *self, IoObject *locals, IoMessage *m)
{
	/*doc File groupId
	Returns a Number containing the group id associated with the file's path.
	*/

	return IONUMBER(IoFile_statPointer(self, locals, m)->st_gid);
}
Exemple #3
0
IoObject *IoFile_statSize(IoFile *self, IoObject *locals, IoMessage *m)
{
	/*doc File statSize
	Returns the file's size in bytes as a Number.
	*/

	return IONUMBER(IoFile_statPointer(self, locals, m)->st_size);
}
Exemple #4
0
IoObject *IoFile_isSocket(IoFile *self, IoObject *locals, IoMessage *m)
{
	/*doc File isSocket
	Returns true if the receiver's file descriptor is a Socket, false otherwise.
	*/

	return IOBOOL(self, S_ISSOCK(IoFile_statPointer(self, locals, m)->st_mode));
}
Exemple #5
0
IoObject *IoFile_isRegularFile(IoFile *self, IoObject *locals, IoMessage *m)
{
	/*doc File isRegularFile
	Returns true if the receiver's file descriptor is a regular file, false otherwise.
	*/

	return IOBOOL(self, S_ISREG(IoFile_statPointer(self, locals, m)->st_mode));
}
Exemple #6
0
IO_METHOD(IoFile, isSocket)
{
	/*doc File isSocket
	Returns true if the receiver's file descriptor is a Socket, false otherwise.
	*/

	return IOBOOL(self, S_ISSOCK(IoFile_statPointer(self, locals, m)->st_mode));
}
Exemple #7
0
IO_METHOD(IoFile, isPipe)
{
	/*doc File isPipe
	Returns true if the receiver is a pipe, false otherwise.
	*/

	return IOBOOL(self, S_ISFIFO(IoFile_statPointer(self, locals, m)->st_mode));
}
Exemple #8
0
IO_METHOD(IoFile, isRegularFile)
{
	/*doc File isRegularFile
	Returns true if the receiver's file descriptor is a regular file, false otherwise.
	*/

	return IOBOOL(self, S_ISREG(IoFile_statPointer(self, locals, m)->st_mode));
}
Exemple #9
0
IO_METHOD(IoFile, isDirectory)
{
	/*doc File isDirectory
	Returns true if the receiver's path points to a directory, false otherwise.
	*/

	return IOBOOL(self, S_ISDIR(IoFile_statPointer(self, locals, m)->st_mode));
}
Exemple #10
0
IO_METHOD(IoFile, statSize)
{
	/*doc File statSize
	Returns the file's size in bytes as a Number.
	*/

	return IONUMBER(IoFile_statPointer(self, locals, m)->st_size);
}
Exemple #11
0
IO_METHOD(IoFile, groupId)
{
	/*doc File groupId
	Returns a Number containing the group id associated with the file's path.
	*/

	return IONUMBER(IoFile_statPointer(self, locals, m)->st_gid);
}
Exemple #12
0
IoObject *IoFile_isPipe(IoFile *self, IoObject *locals, IoMessage *m)
{
	/*doc File isPipe
	Returns true if the receiver is a pipe, false otherwise.
	*/

	return IOBOOL(self, S_ISFIFO(IoFile_statPointer(self, locals, m)->st_mode));
}
Exemple #13
0
IoObject *IoFile_protectionMode(IoFile *self, IoObject *locals, IoMessage *m)
{
	/*doc File protectionMode
	Returns a Number containing the protection mode
	associated with the file's path.
	*/

	return IONUMBER(IoFile_statPointer(self, locals, m)->st_mode);
}
Exemple #14
0
IO_METHOD(IoFile, protectionMode)
{
	/*doc File protectionMode
	Returns a Number containing the protection mode
	associated with the file's path.
	*/

	return IONUMBER(IoFile_statPointer(self, locals, m)->st_mode);
}
Exemple #15
0
IoObject *IoFile_isUserExecutable(IoFile *self, IoObject *locals, IoMessage *m)
{
	/*doc File isUserExecutable
	Returns true if the receiver is user group executable, false otherwise.
	*/
	
#ifdef ON_WINDOWS
	return IOFALSE(self);
#else
	mode_t mode = IoFile_statPointer(self, locals, m)->st_mode;
	mode_t check = S_IXUSR;
	return IOBOOL(self, mode & check);
#endif
}
Exemple #16
0
IoObject *IoFile_lastAccessDate(IoFile *self, IoObject *locals, IoMessage *m)
{
	/*doc File lastAccessDate
	Returns a Date object containing the last date and
	time the file was accessed.
	*/

	struct stat *s = IoFile_statPointer(self, locals, m);
#ifndef _POSIX_C_SOURCE
	struct timeval tv = timespec2timeval(s->st_atimespec);
#else
	struct timeval tv = time_t2timeval(s->st_atime);
#endif


	return IoDate_newWithTimeval_(IOSTATE, tv);
}
Exemple #17
0
IO_METHOD(IoFile, lastInfoChangeDate)
{
	/*doc File lastInfoChangeDate
	Returns a Date object containing the last date and
	time the file's meta info was changed.
	*/

	struct stat *s = IoFile_statPointer(self, locals, m);

#ifndef _POSIX_C_SOURCE
	struct timeval tv = timespec2timeval(s->st_ctimespec);
#else
	struct timeval tv = time_t2timeval(s->st_ctime);
#endif


	return IoDate_newWithTimeval_(IOSTATE, tv);
}
Exemple #18
0
IoObject *IoFile_lastDataChangeDate(IoFile *self, IoObject *locals, IoMessage *m)
{
	/*doc File lastDataChangeDate
	Returns a Date object containing the last date and
	time the file's contents were changed.
	*/

	struct stat *s = IoFile_statPointer(self, locals, m);
#ifndef _POSIX_C_SOURCE
	struct timeval tv = timespec2timeval(s->st_mtimespec);
#else
	struct timeval tv = time_t2timeval(s->st_mtime);
#endif
	/*
	struct gettv get_tv;
	struct timezone timezone;
	struct tm *t;
	gettimeofday(&get_tv, &timezone);
	printf("stattv.tv_sec = %i\n", tv.tv_sec);
	printf("get_tv.tv_sec = %i\n", get_tv.tv_sec);
	*/
	return IoDate_newWithTimeval_(IOSTATE, tv);
}