• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Reading file permissions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading file permissions


  • Subject: Re: Reading file permissions
  • From: Sam Carr <email@hidden>
  • Date: Wed, 26 Nov 2003 19:16:01 +0000

Indeed, 644 is octal, so to convert it to decimal we do:
4 + (4*8) + (6*8*8) = 420

The number you get back is completely correct. Converting in the other direction is left as an exercise for the reader :-)

Sam

On 26 Nov 2003, at 18:22, David Kocher wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

That's what I thought as well, but actually I get '420' back?!

On 26. Nov 2003, at 18:53, Stephane Sudre wrote:


On Wednesday, November 26, 2003, at 06:37 PM, David Kocher wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I am reading the file permissions from a file like this
NSDictionary localAttributes = NSPathUtilities.fileAttributes(file.getPath(), true);
int localPermissions = ((Integer)localAttributes.objectForKey(NSPathUtilities.FilePosixPermi ssions)).intValue();

What I am wondering how I can convert this integer to a number I am used to, like 644 representing rw-r--r--

Thanks for the introduction to 'posix permissions for dummies'

AFAIK, this is your int. It's just that "644" is in fact 0644 which is an octal number.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQE/xO9mdBH4SdTFvT4RAlDKAJ9YDDrh1etqhxeKWDLCY/SWbIM6nACeKTzg
gGggIMZl2LUuYjGFhedyhhk=
=VI7h
-----END PGP SIGNATURE-----
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Reading file permissions (From: David Kocher <email@hidden>)

  • Prev by Date: Re: Reading file permissions
  • Next by Date: NSImage inside an NSAttributedString ?
  • Previous by thread: Re: Reading file permissions
  • Next by thread: Re: Reading file permissions
  • Index(es):
    • Date
    • Thread