This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization 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
Pie
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