?
Solved

How can find a temp folder where the current user has the access right

Posted on 2004-11-05
8
Medium Priority
?
399 Views
Last Modified: 2013-11-20
How can find a temp folder where the current user has the access right?
My application will generate template html files in a temp folder under the application path (usually, administrator user installed it in "C:\Program Files\BillcchApp"), but some of users don't have the access right on the application folder. How can I find the path that current user has the access right.... using GetTempPath() API can handle this job or not?

Thanks
0
Comment
Question by:billcch
  • 4
  • 4
8 Comments
 
LVL 19

Accepted Solution

by:
mrwad99 earned 2000 total points
ID: 12507422
I would imagine that it could, yes.  Reading the dox on the subject, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/gettemppath.asp
:
"The GetTempPath function checks for the existence of environment variables in the following order and uses the first path found:

   1. The path specified by the TMP environment variable.
   2. The path specified by the TEMP environment variable.
   3. The path specified by the USERPROFILE environment variable.
   4. The Windows directory.
"
paying attention to #3.

You can always test for failure, and then create another temporary directory somewhere else of your choosing if required.

Alternatively, why not just create a folder that all users can have access to, and dump your HTML there ?
0
 

Author Comment

by:billcch
ID: 12507800
Thanks,
why not just create a folder that all users can have access to, and dump your HTML there ?
I like to...
but which folder that all users can have access?
how can I get it?
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 12507958
You could always create a folder under "All users"; C:\\Documents and Settings\\All Users

I even think that it would not be an issue having several copies of the HTML files in each of the user's own space; HTML is only KB at the most.

But I would go with the "All users" option personallyl
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:billcch
ID: 12508174
How about Win98?...
There is no C:\\Documents and Settings\\All Users folder...
shold I need to check which OS (98/me/2000/nt/xp) user are using...
One thing is very important for me...
once the C++ generate the temp html file, the c++ code need to let a javascript program to know
where the temp file located...
my original design that c++ write down the full path into an ini file which locate in "APPLICATION FOLDER", but user might not have the access right, so the full path information will never pass to the javascript program...
Please help me...
Thanks!
0
 

Author Comment

by:billcch
ID: 12508241
PS... I don't know how to let javascript find the temp folder (the same folder that I can get from VC++)...
Thanks
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 12513262
You could always have the user browse to find a suitable directory, then write this in the registry and use it again at a later date.  A convenient place to do this would be on the first run of your application, as part of the install.
0
 

Author Comment

by:billcch
ID: 12669880
Thanks, sorry I went to business trip, and did not have chance back to ee to thanks you guys.
Thanks again!
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 12672656
Glad to help :)
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question