Users folder in Mac OS X?

havic

Windsurfer Nerd
Well, the stock standard users folder on OS X 10.1 and 10.2 is called Users and is located in the root dir of the boot volume.
My question is if 10.3 changes this, and also if it is possible (as a root, admin or normal user) to change this. The reason being is that I want to get the users preferences directory, which will be located at /Users/username/Library/Preferences, and that works fine for me, but if they have changed that somehow, eg. they have renamed Users to say, "Active Users" it won't work any more.

Can anyone verify that the preferences directory will always be located at that location?
 
By default, yes, it will. If they've changed it, you should change it back to make sure everything runs smoothly.
 
havic said:
Can anyone verify that the preferences directory will always be located at that location?
You could of course also access the the preference directory by using
Code:
~username/Library/Preferences
instead in which case it will always work regardless of any future change.
 
Well, obviously it will be by default, but my question is if it *can* be changed.

zap, I tried using "-<insert name here>/Library/Preferences" to get at it, and it didn't work. Any other ideas?
 
havic said:
Well, obviously it will be by default, but my question is if it *can* be changed.

zap, I tried using "-<insert name here>/Library/Preferences" to get at it, and it didn't work. Any other ideas?

Did you really use a dash in front of the username? It needs to be a tilde.
 
hazmat, I tried that as well. I'm using fopen() to get the file, so I can't imagine it will evaluate paths the same way as OS X. I would imagine I need to use exact paths. I probably also need to read the man page :p
 
Ah, well I don't know what to tell you. But what I CAN tell you is that 10.3's home directories are in fact in /Users and I don't see that ever changing. If it DID, I'm sure it would only be in a very major release and you could find out before. But if you do want to change the home directory of a user (not sure if you can do it for all at once) you can do it in NetInfo.

Hope this helps.
 
Why don't you just use the tilde ~ symbol to point to the user's home folder. By this standard, you will always be able to find the Library/Preferences folder by using:
~/Library/Preferences.
 
No, fopen() takes the ~ literally, so it will try to go to the folder called ~ in the root dir. I am pretty confident my method works, but it could theoretically be broken by a crazy user.

I'm re-writing that portion of code to make sure that it can't be broken. You would be surprised by how many crazy users there are these days :p
 
havic said:
No, fopen() takes the ~ literally, so it will try to go to the folder called ~ in the root dir. I am pretty confident my method works, but it could theoretically be broken by a crazy user.

I'm re-writing that portion of code to make sure that it can't be broken. You would be surprised by how many crazy users there are these days :p

I just came up with another method you could use. I haven't tested it though but it should work.

You could use the enivornment variable $HOME by doing something like this:
Code:
char *home = getenv("HOME");
 
Oh yes, that would probably work. Good idea zap :p
I don't have time to test it out now, I just got back from a holiday and I'm leaving on another one in about 1 hour, but I'll try it out upon arrival home.
 
Back
Top