PC Review


Reply
Thread Tools Rate Thread

%USERPROFILE% working Bad

 
 
Ray at
Guest
Posts: n/a
 
      4th Nov 2003
Please don't multipost. Follow up in the first group to which you posted
this message.

Ray at work

"Fábio Losnak" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
> I have a Program that uses by default a .ini file inside this program
> directory. But if i want to run personally , for each user , to catch his
> personal profiles, like temp directories , etc.. i need to put that .ini
> file inside Documents and Settings\%USERNAME%\Windows.
>
> The problem is :
> For some users, it works and for other users, it doesn´t works. When it
> doesnt work the program uses the default .ini file, causing me conflict of
> temp files created by the program when the user run it.
> I realized that the %HOMEPATH% for that " working good" users is like:
> c:\Documents and settings\%USERNAME% and for the others it is blank.

Another
> thing i realized is that when i logon with a "working good" user that

folder
> (%USERPROFILE%\WINDOWS) is automatically created and for the others dont.
>
> There is a way to configure or to correct that specificattions for this
> "working bad " users?
>
> Thanks
> Leonardo
>
>
>



 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      4th Nov 2003
Please don't multipost. Follow up in the first group to which you posted
this message.

Ray at work

"Fábio Losnak" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
> I have a Program that uses by default a .ini file inside this program
> directory. But if i want to run personally , for each user , to catch his
> personal profiles, like temp directories , etc.. i need to put that .ini
> file inside Documents and Settings\%USERNAME%\Windows.
>
> The problem is :
> For some users, it works and for other users, it doesn´t works. When it
> doesnt work the program uses the default .ini file, causing me conflict of
> temp files created by the program when the user run it.
> I realized that the %HOMEPATH% for that " working good" users is like:
> c:\Documents and settings\%USERNAME% and for the others it is blank.

Another
> thing i realized is that when i logon with a "working good" user that

folder
> (%USERPROFILE%\WINDOWS) is automatically created and for the others dont.
>
> There is a way to configure or to correct that specificattions for this
> "working bad " users?
>
> Thanks
> Leonardo
>
>
>



 
Reply With Quote
 
Fábio Losnak
Guest
Posts: n/a
 
      4th Nov 2003
Hello,
I have a Program that uses by default a .ini file inside this program
directory. But if i want to run personally , for each user , to catch his
personal profiles, like temp directories , etc.. i need to put that .ini
file inside Documents and Settings\%USERNAME%\Windows.

The problem is :
For some users, it works and for other users, it doesn´t works. When it
doesnt work the program uses the default .ini file, causing me conflict of
temp files created by the program when the user run it.
I realized that the %HOMEPATH% for that " working good" users is like:
c:\Documents and settings\%USERNAME% and for the others it is blank. Another
thing i realized is that when i logon with a "working good" user that folder
(%USERPROFILE%\WINDOWS) is automatically created and for the others dont.

There is a way to configure or to correct that specificattions for this
"working bad " users?

Thanks
Leonardo



 
Reply With Quote
 
Mark V
Guest
Posts: n/a
 
      5th Nov 2003
In microsoft.public.win2000.registry Fábio Losnak wrote:

> Hello,
> I have a Program that uses by default a .ini file inside this
> program directory. But if i want to run personally , for each user
> , to catch his personal profiles, like temp directories , etc.. i
> need to put that .ini file inside Documents and
> Settings\%USERNAME%\Windows.
>
> The problem is :
> For some users, it works and for other users, it doesn´t works.
> When it doesnt work the program uses the default .ini file,
> causing me conflict of temp files created by the program when the
> user run it. I realized that the %HOMEPATH% for that " working
> good" users is like: c:\Documents and settings\%USERNAME% and for
> the others it is blank. Another thing i realized is that when i
> logon with a "working good" user that folder
> (%USERPROFILE%\WINDOWS) is automatically created and for the
> others dont.
>
> There is a way to configure or to correct that specificattions for
> this "working bad " users?


All I have are suggestions.
Don't use %homepath% (this is not always reliable)
Do use %userprofile%
and %temp% (in most cases %temp% under a given account/profile
will be both correct and read/writable by that account. (but you
should probably test/handle that as well).
Use "%userprofile%\Application Data\<Your_app_name>" (this is the way
it is "supposed" to be done).
You should probably test for existence of the directory or file and
if not found trap the error and handle it. If needed, attempt to
create the directory and test for success/fail and handle that as
well. I would not rely on "is automatically created" at all.

Good programming practice should not make assumptions about existence
or access and everywhere you rely on "I can assume this works" you
should really be confirming it "for sure".

I assume you specifically do not want to use the registry (HKCU) to
store settings and that is the reason for INI files.


 
Reply With Quote
 
 
 
 
Mark V
Guest
Posts: n/a
 
      5th Nov 2003
In microsoft.public.win2000.registry Fábio Losnak wrote:

> Hello,
> I have a Program that uses by default a .ini file inside this
> program directory. But if i want to run personally , for each user
> , to catch his personal profiles, like temp directories , etc.. i
> need to put that .ini file inside Documents and
> Settings\%USERNAME%\Windows.
>
> The problem is :
> For some users, it works and for other users, it doesn´t works.
> When it doesnt work the program uses the default .ini file,
> causing me conflict of temp files created by the program when the
> user run it. I realized that the %HOMEPATH% for that " working
> good" users is like: c:\Documents and settings\%USERNAME% and for
> the others it is blank. Another thing i realized is that when i
> logon with a "working good" user that folder
> (%USERPROFILE%\WINDOWS) is automatically created and for the
> others dont.
>
> There is a way to configure or to correct that specificattions for
> this "working bad " users?


All I have are suggestions.
Don't use %homepath% (this is not always reliable)
Do use %userprofile%
and %temp% (in most cases %temp% under a given account/profile
will be both correct and read/writable by that account. (but you
should probably test/handle that as well).
Use "%userprofile%\Application Data\<Your_app_name>" (this is the way
it is "supposed" to be done).
You should probably test for existence of the directory or file and
if not found trap the error and handle it. If needed, attempt to
create the directory and test for success/fail and handle that as
well. I would not rely on "is automatically created" at all.

Good programming practice should not make assumptions about existence
or access and everywhere you rely on "I can assume this works" you
should really be confirming it "for sure".

I assume you specifically do not want to use the registry (HKCU) to
store settings and that is the reason for INI files.


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
%USERPROFILE% working Bad Ray at Microsoft Windows 2000 Registry 2 5th Nov 2003 03:47 PM
%USERPROFILE% working Bad Ray at Microsoft Windows 2000 1 4th Nov 2003 11:14 PM
%USERPROFILE% working Bad Fábio Losnak Microsoft Windows 2000 Registry 0 4th Nov 2003 11:10 PM
%USERPROFILE% working Bad Fábio Losnak Microsoft Windows 2000 Registry Archive 0 4th Nov 2003 11:10 PM
%USERPROFILE% working Bad Fábio Losnak Microsoft Windows 2000 Registry Archive 0 4th Nov 2003 11:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:02 AM.