Determining if a Mac OS X directory is locked

Ken Ray kray at sonsothunder.com
Tue May 27 17:42:02 EDT 2003


Tom,

You can use shell() to do an "ls -l" on the parent of the directory
you're looking for. Look at the first "column" of data (the access
modes) to determine if the directory is read only or not. 

Here's a way to do it (in this example, I'm looking at a directory
called "Evaluate" on my desktop to see if it is read only):

on mouseUp
  answer IsReadOnly("Evaluate")
end mouseUp

function IsReadOnly pWhat 
  -- Go to the home folder, then the Desktop 
  -- folder inside, then get a listing
  put shell("cd ~;cd desktop;ls -l") into temp
  put lineOffset(space & pWhat &cr,temp) into tLine
  put char 2 to 10 of word 1 of tLine into tAccessModes
  return ("w" is in tAccessModes)
end IsReadOnly

Hope this helps,

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/ 

> -----Original Message-----
> From: use-revolution-admin at lists.runrev.com 
> [mailto:use-revolution-admin at lists.runrev.com] On Behalf Of 
> Thomas Speitel
> Sent: Tuesday, May 27, 2003 4:53 PM
> To: use-revolution at lists.runrev.com
> Subject: Determining if a Mac OS X directory is locked
> 
> 
> Hi Folks,
> I am looking for a way to determine if a directory is locked before 
> trying to save a movie or sound file to it.
> Thanks,
> Tom
> 
> Tom Speitel
> Curriculum Research & Development Group
> College of Education
> University of Hawaii
> 1776 University Avenue
> Honolulu, HI 96822
> 
> Phone: 808-956-6855
> Fax: 808-956-64933
> www.hawaii.edu/crdg
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com 
> http://lists.runrev.com/mailman/listinfo/use-> revolution
> 





More information about the use-livecode mailing list