-
Notifications
You must be signed in to change notification settings - Fork 0
/
setftype.c
39 lines (29 loc) · 905 Bytes
/
setftype.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma optimize 79
#include <GSOS.h>
#include <stdlib.h>
#include <gno/gno.h>
#include "prototypes.h"
int setfileattr(const char *filename, FileInfoRecGS *info, unsigned flags)
{
Word rv;
FileInfoRecGS tmp;
if (!info) return 0;
if (!flags) return 1;
tmp.pCount = 7;
tmp.pathname = (GSString255Ptr)__C2GSMALLOC(filename);
if (!tmp.pathname) return 0;
GetFileInfoGS(&tmp);
rv = _toolErr;
if (!_toolErr)
{
if (flags & ATTR_ACCESS) tmp.access = info->access;
if (flags & ATTR_FILETYPE) tmp.fileType = info->fileType;
if (flags & ATTR_AUXTYPE) tmp.auxType = info->auxType;
if (flags & ATTR_CREATETIME) tmp.createDateTime = info->createDateTime;
if (flags & ATTR_MODTIME) tmp.modDateTime = info->modDateTime;
SetFileInfoGS(&tmp);
rv = _toolErr;
}
free (tmp.pathname);
return rv ? 0 : 1;
}