Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing permissions on system files



Eric Kolotyluk wrote:

>I've written some code during our application start up that checks all
>the usual places for fonts to see if Arial and Helvetica have been
>removed. If they have, I throw up a dialog asking them if they want to
>install Helvetica. I use the Lucida Grande font for the dialog because
>I'm told that if Lucida Grande is missing, Mac OS won't run very well
>anyway (so the point is moot).

A reasonable strategy.


>I thought the best place to install Helvetica would be
>
>/System/Library/Frameworks/JavaVM.framework/versions/1.4.2/Home/lib/font
>s

Have you confirmed that installing Helvetica there actually prevents crashes?

Although Java code might look there, I don't think Mac OS X native code
will, and it's native code that's the problem.  However, I could be wrong,
so I suggest a deliberate crash-test.

I don't know of an app-specific Fonts folder, only user-specific.  Adobe
and some other mfgrs have app-specific font folders, but I think that uses
app-specific code they wrote.  Whether the JVM does this or not, I don't
know, which is why I suggest the crash-test.


>However, this
>directory is owned by root, and there is no write access for the wheel
>group or others. I thought I could temporarily chown the fonts directory
>to a user with admin rights, install the font file, then chown it back
>to root.

Since you'd have to be root in order to chown the dir, you can just do the
copy as root directly, and not have to chown anything.  Ownership and
privileges are irrelevant when you're omnipotent.

So doing this as root:
  chown $ADMIN $FONTDIR
  cp $FONTPARKING/Helvetica.dfont $FONTPARKING/Arial.dfont $FONTDIR
  chown root $FONTDIR

can be replaced by:
  cp $FONTPARKING/Helvetica.dfont $FONTPARKING/Arial.dfont $FONTDIR


I also recommend ensuring the installed fonts are always readable,
regardless of what the permissions are in $FONTPARKING:
  chmod a+r $FONTDIR/Helvetica.dfont $FONTDIR/Arial.dfont

Which must also be done as root.

Although I'm using shell variables for the example, you can of course
hard-wire whatever text you want.  If you do want to user shell-variables
in a single exec(), I suggest the 'env' command, with 'sh -c' as its target
command.  If that doesnt make sense after reading 'man env' and 'man sh',
ask again.

  -- GG


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.