[Pythonmac-SIG] stat(), alias files

Joseph J. Strout joe@strout.net
Wed, 28 Jul 1999 16:03:06 -0700

At 6:23 PM -0400 07/28/99, Doug Wyatt wrote:

>1. A file modification time returned by os.stat() is 4 years in the past
>compared to a time constructed with time.mktime().  I suspect this is a
>GUSI issue.

No, this is a documented difference between MacOS times and Python 
standard times.  One is based on Jan 1, 1900, while the other is Jan 
1, 1904.

>2. I've been writing programs to scan directories, and keep tripping over
>alias files.  It's particularly problematic when I use
>macfs.ResolveAliasFile and there pops up a dialog to insert a CD or mount a
>server.  I'd rather just ignore alias files rather than pass every single
>file/directory I encounter to ResolveAliasFile.  Have I missed a call that
>will tell me whether a file is an alias?  I could test FInfo.Flags (where
>0x8000 is kIsAlias), but I don't see a way to fetch a file's FInfo.

Here's the code from my little FileCrawler class I posted a while back:

			spec = macfs.FSSpec(fpath)
				info = spec.GetFInfo()
				# if GetFInfo fails, it must be a folder!
				info = macfs.FInfo()
				info.Type = 'fldr'
			if info.Flags & kIsAlias:
				if info.Type == 'fdrp':

See, you get a file's FInfo with GetFInfo().

>I'd be happy to dig in and fix things if I knew what the right places for
>the fixes would be.

Your code, I'd say.   ;)

-- Joe

|    Joseph J. Strout           Biocomputing -- The Salk Institute |
|    joe@strout.net             http://www.strout.net              |