7 Replies - 874 Views - Last Post: 18 July 2012 - 07:18 PM

#1 burgo857  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 18
  • Joined: 02-June 12

How to determine/find program files

Posted 17 July 2012 - 10:46 PM

The program i am working on patches/updates the clients game...

The game it is made for is very old and it has 2 patches. For a person to play they need to install the patch. Once the patch is installed if they decide they want to play using the other patch they have to uninstall everything and start again.

I wanted to make a program to fix the issue,
The program i have made has two buttons. Version1 and Version2. When they click Version1 button it searches C:\PROGRA~1\Game\ For files, deletes specified files and then copy's files from the folder that comes with my program installed in program files. to the game path.

I realized the above path i am using. If they aren't using windows 32 bit this will not work. How do i determine the clients program files location if i am using inno setup?

Is This A Good Question/Topic? 0
  • +

Replies To: How to determine/find program files

#2 janne_panne  Icon User is offline

  • WinRT Dev
  • member icon

Reputation: 428
  • View blog
  • Posts: 1,047
  • Joined: 09-June 09

Re: How to determine/find program files

Posted 17 July 2012 - 11:21 PM

I'm not sure what inno setup is capable of, so this advice might be wrong. But what I would do is check the common paths where user usually installs the games, like program files folder and program files (x86) folder. If the game is not found there, ask the user where the game is located.

Or does the installation leave a mark in a registry? That might tell you the exact path to the game install directory.
Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6107
  • View blog
  • Posts: 23,659
  • Joined: 23-August 08

Re: How to determine/find program files

Posted 18 July 2012 - 04:23 AM

This is not a C# problem, so I'll move this to Software Development.
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5674
  • View blog
  • Posts: 12,189
  • Joined: 02-June 10

Re: How to determine/find program files

Posted 18 July 2012 - 06:04 AM

You can't even be sure there is a C: Drive to start with. I've been on computers that booted on D:

Look at the SpecialFolders enum to check for the startup drive.

The build paths using System.IO.Path.Combine and check if the file is in Program Files or Program Files (x86)

There is no magic here. You program has to do some work and look around.
Was This Post Helpful? 1
  • +
  • -

#5 burgo857  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 18
  • Joined: 02-June 12

Re: How to determine/find program files

Posted 18 July 2012 - 07:31 AM

View PosttlhIn`toq, on 18 July 2012 - 06:04 AM, said:

You can't even be sure there is a C: Drive to start with. I've been on computers that booted on D:

Look at the SpecialFolders enum to check for the startup drive.

The build paths using System.IO.Path.Combine and check if the file is in Program Files or Program Files (x86)

There is no magic here. You program has to do some work and look around.


Oh ok. You wouldn't happen to be able to have a link to that by any chance mate?
Was This Post Helpful? -1
  • +
  • -

#6 Ryano121  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1363
  • View blog
  • Posts: 3,002
  • Joined: 30-January 11

Re: How to determine/find program files

Posted 18 July 2012 - 07:34 AM

SpecialFolders

Although seriously, just Google 'msdn specialfolders' and its the very first link.
Was This Post Helpful? 2
  • +
  • -

#7 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5674
  • View blog
  • Posts: 12,189
  • Joined: 02-June 10

Re: How to determine/find program files

Posted 18 July 2012 - 07:41 AM

Finding answers to specific problems:

Sometimes just knowing where to look can make all the difference. Google is your friend.
Search with either "C#" or "MSDN" as the first word: "MSDN Picturebox", "C# Custom Events", "MSDN timer" etc.
How to do a good search that will get you targeted answers.

This post has been edited by tlhIn`toq: 18 July 2012 - 07:41 AM

Was This Post Helpful? 0
  • +
  • -

#8 burgo857  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 18
  • Joined: 02-June 12

Re: How to determine/find program files

Posted 18 July 2012 - 07:18 PM

Thanks guys...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1