objective c - With Cocoa how do i check that given file is owned by current user? -


How do I check that this file is owned by the current user while viewing a file path? Currently I have been able to get it:

  [[NSFileManager defaultManager] attributesOfItemAtPath: filePath error: outError] fileOwnerAccountID];  

Return NSNumber *. But how can I get an existing user account id to compare it with, it can not be for Google. Apart from this, all this looks messy, there is no better way to do this, is not it?

You can get the current user's ID with Getuid ().

The reason is that you want that there is no single-call method of obtaining information that it is unusual for a program that the user is the owner of the file; OS X, like Unix in general, is more about permissions than ownership, so usually you are using calls like WRitableFileAtPath: or isDeletableFileAtPath:


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -