Determining read-only status of a file/folder

  • Hi Keith,
    I got (and fixed) the same problem.
    For some unknown reason, my MainMenu.nib file (which is a File Package, that
    is, a folder looking like a file) turned into a "No Access" for "Others" and
    the "Group" permissions disappeared. So if the current user did not install
    my application (but some other user), he gets the message you described and
    cannot launch the application. I presume your project file (which is a File
    Package too) has not the right permissions. And/Or, the files it contains
    have not the right permissions. So you have to set the right permissions to
    this files and to all the resource files you use. Then clean and recompile.

    Detail
    You have to set the "Others" permissions to, at least, "Read Only".
    In the Finder, click on your original project file.
    Call the "File:Get Info" menu item and change its permissions.
    Since the file is really a file package, you should change the permissions
    to all its nested files.

    So open the File Package this way. In the Finder, click on your project file
    holding down the Control key and choose the menu item "Show Package
    Contents". Then select the file you need, one by one, and call the "File:Get
    Info" menu item and change its permissions. Do this task to all the resource
    files.

    There is a way to change the permissions of a file package or folder
    contents recursively using Terminal. But I guess you are not familiar with
    it.

    Best Regards
    --
    Lorenzo
    email: <archidea...>

    > From: <cocoa-dev-request...>
    > Reply-To: <cocoa-dev...>
    > Date: Sat, 27 Oct 2007 06:09:36 -0700 (PDT)
    > To: <cocoa-dev...>
    > Subject: Cocoa-dev Digest, Vol 4, Issue 1062
    >
    > Date: Sat, 27 Oct 2007 04:48:49 -0700 (PDT)
    > From: Keith Blount <keithblount...>
    > Subject: Determining read-only status of a file/folder
    > (isWritableFileAtPath)?
    > To: <cocoa-dev...>
    > Message-ID: <382580.63039.qm...>
    > Content-Type: text/plain; charset=us-ascii
    >
    > Hi,
    >
    >
    > My app uses a project-based format - really just a folder full of files but
    > with an extension so that it looks like a regular file. As such, when a
    > project is opened, the main project file is opened by the app (kind of like
    > the .xcodeproj file in Xcode) and other files inside the package are opened as
    > needed. Because of this, and because my app has an auto-save feature, my app
    > doesn't support the opening of read-only projects, or of projects that are
    > stored in non-writable locations.
    >
    >
    > Thus, if the user tries to open a project from a non-writable location, my
    > program just spews a message saying that it doesn't support read-only files
    > and gives the user a hint about what to do.
    >
    >
    > I'm using NSFileManager's -isWritableFileAtPath: to check this. I check the
    > package folder itself, and also the main project file inside. If the file
    > manager returns one or both as not being writable, the user gets the message.
    >
    >
    > For the most part, this works fine. However, occasionally I get users
    > reporting to me that they have received this message when they shouldn't -
    > often, for instance, when the project is stored on an external drive (which is
    > nonetheless writable) or when they are accessing it over a network.
    >
    >
    > The docs don't really explain the exact circumstances in which
    > -isWritableFileAtPath: returns NO. So, my question is, is NSFileManager the
    > best way of doing this, or is there a better way? (Please don't tell me off
    > for not supporting read-only projects. :) I hope to do so in a future
    > version...)
    >
    >
    > All the best,
    > Keith
previous month october 2007 next month
MTWTFSS
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        
Go to today