Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Preferences on the Mac

 
Mike Lipay
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried creating a preferences file using the code below, it works on Windows but not on Mac. Is there something else I need to do, or a different way to accomplish this?

 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the user executing the code doesn't have permission to write on the path used (the whole path) - then it is not possible.

OS X is based on Unix (or is Unix), therefore the right owner/group permissions are needed.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think there should be a permissions problem - a user should be able to access anything in her own userRoot, no?

Or do you mean the actual file "/Users/xyz/Library/Preferences/com.lipay.swreg.plist"? That would be screwed-up file permissions, though.
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:I don't think there should be a permissions problem - a user should be able to access anything in her own userRoot, no?

Or do you mean the actual file "/Users/xyz/Library/Preferences/com.lipay.swreg.plist"? That would be screwed-up file permissions, though.


I think it could be necessary to do a "Repair Disk Permissions" with "Disk Utility"??

I have just tested the code posted, and it works on my Mac.
 
Mike Lipay
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks everyone, I found the problem.

Working between the two platforms I missed changing a \ to a / when I moved it to the Mac. After doing a couple different searches on this forum I finally hit one that covered System.getProperty("file.separator"), our class hasn't covered system properties yet, so I replaced \ everywhere with the file separator constant.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic