Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...with companys cutting back on training, lack of true support by makers of software, the forums are a great tool in your cyber-toolbox...."

Geography

Where in the world do Tek-Tips members come from?
BorlandDave (Programmer)
21 Jun 06 10:36
I am currently developing some software which is to be used internationally. I therefore need to be a bit clever with where my program reads/writes to files because locations such as "C:\Program Files" may not exist on foriegn systems. I have done a bit of research but am still a bit unclear on a couple of things. I think I can get to "C:\Program Files\.." and C:\Windows\.. by using %ProgramFilesDir%\.. and %WinDir%\..

Are there any more of these shortcuts?

Also, how do I specify the root of the current drive. My program could be installed on any drive letter, so how do I know which one?

Cheers for any help.
Helpful Member!  ctoma2005 (Programmer)
21 Jun 06 11:26
Check this site out:
 http://kennethhunt.com/archives/000933.html

These are actually enviroment variables.For example, SYSTEMDRIVE would return "C:" if the system is installed on C. The same for WINDIR.For seeing the operating system see the variable OS(Microsoft family). Unix also has these variables...see
   http://www.ee.surrey.ac.uk/Teaching/Unix/unix8.html
 In UNIX just type "echo $OSTYPE", to get to the root try "cd /".

I'm not quite sure how to find the exact number of partitions and their names, but their must be a way to try the command "cd f:" and not show the error to the user, but I forgot how. Hope this helps you.
BorlandDave (Programmer)
22 Jun 06 4:28
Thanks for the help! I am using Windows XP.

What happens if there is a multi-partition system with windows installed on C: and my program installed on D: In this case I'd want to be able to somehow specify D: as a root directory to write files to, but wouldn't SYSTEMDRIVE return C: instead?
ctoma2005 (Programmer)
22 Jun 06 7:24
I am not quite sure if I understand the question. Well if you create a setup for your program, when the user installs the program you already know the partition where he installed it, since he specified the "install path". I haven't yet found how to query windows to tell you the number of partitions and their names. I'm going to look in to it. Again, tell me how you want the user to use your program, since the most important thing is to make your changes without the user realising.
TonyGroves (Programmer)
22 Jun 06 8:29
You can get a list of all environment variables with the shell command "set". Your programs can retrieve them using the function "getenv".
BorlandDave (Programmer)
23 Jun 06 7:44
Thanks again for the help.

First of all, am I correct in thinking paths such as "C:\Program Files" are different in different language versions of Windows? I just installed my prog on a Turkish laptop and although lots of things were in Turkish, like most of the start menu, the Program Files path was still in English.

ctoma2005, I'm not very good at explaining things clearly but I'll expand a bit on my problem. Say for instance I have a multi-module program connected through COM interfaces installed in:

"..\MyProg\FirstModule"
"..\MyProg\SecondModule"
"..\MyProg\ThirdModule"
etc.

I want to store the path "..\MyProg" as a default-directory string in each module. How can I do this?
Helpful Member!  Totte (Programmer)
24 Jun 06 12:52
To me this is one of the things you use the registry to do.

Make an entry in the registry when installing and later read out that entry, then you got the datas for that PC.

Totte
Keep making it perfect and it will end up broken.

BorlandDave (Programmer)
26 Jun 06 4:03
Ahh, that sounds like a good idea! I'll have to try and work out how to do it.

Thanks for the help!

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close