danwsc
August 9th, 2010, 04:16 PM
Hi,
I'm trying to write an application that makes use of a number of files stored in a application data directory. At the moment I've put the data directory in ~/.myapp/$USER.default/data
The things is that if my application is installed by say dpkg -i, then it would need superuser privilege so I would need to do
$ sudo dpkg -i ......
Only problem is that once I use sudo, the $USER becomes root and the $HOME becomes /home/root, not the /home/user that my application would look in once it is running.
I've gone through some of the earlier posts and there is one quite similar but I guess I'm too new to Linux to figure out the solution from the replies. I saw someone refer to XDG_DATA_HOME but when I
$echo $XDG_DATA_HOME
I get only a blank and further, won't the user name also change to root once I use sudo?
Please help. This problem has held my work back for quite some time.
Thanks in advance.
I'm trying to write an application that makes use of a number of files stored in a application data directory. At the moment I've put the data directory in ~/.myapp/$USER.default/data
The things is that if my application is installed by say dpkg -i, then it would need superuser privilege so I would need to do
$ sudo dpkg -i ......
Only problem is that once I use sudo, the $USER becomes root and the $HOME becomes /home/root, not the /home/user that my application would look in once it is running.
I've gone through some of the earlier posts and there is one quite similar but I guess I'm too new to Linux to figure out the solution from the replies. I saw someone refer to XDG_DATA_HOME but when I
$echo $XDG_DATA_HOME
I get only a blank and further, won't the user name also change to root once I use sudo?
Please help. This problem has held my work back for quite some time.
Thanks in advance.