Hey everyone I want to get a variable to recognizable the install directory.. How would I do this?
Recognizing the install directory
Page 1 of 15 Replies - 145 Views - Last Post: 15 February 2013 - 08:22 AM
Replies To: Recognizing the install directory
#2
Re: Recognizing the install directory
Posted 14 February 2013 - 05:51 PM
#3
Re: Recognizing the install directory
Posted 14 February 2013 - 06:09 PM
#4
Re: Recognizing the install directory
Posted 14 February 2013 - 06:14 PM
Okay.. I am not sure if that is a question or what. Did you read up on 'current directory'?
#5
Re: Recognizing the install directory
Posted 15 February 2013 - 06:22 AM
CurrentDirectory is good only until that program brings up an OpenFileDialog or SaveFileDialog and the user changes the current directory. (The programmer has to consciously set the RestoreDirectory property to true since the default value is false. Since the current crop of programmers just use Intellisense and don't bother to read the documentation, the chances of a programmer knowing that they should set RestoreDirectory to true is low.)
#6
Re: Recognizing the install directory
Posted 15 February 2013 - 08:22 AM
Well, there's at least one other option:
Application.ExecutablePath
That returns a string with the path of the actual executable. From that, you can parse the directory using Path.GetDirectoryName. Or you could make a FileInfo from it and get the directory that way. Regardless, that doesn't have to deal with the messy idea of a "current path".
To "add your own custom" (directory names, I guess) you'd use Path.Combine
Application.ExecutablePath
That returns a string with the path of the actual executable. From that, you can parse the directory using Path.GetDirectoryName. Or you could make a FileInfo from it and get the directory that way. Regardless, that doesn't have to deal with the messy idea of a "current path".
To "add your own custom" (directory names, I guess) you'd use Path.Combine
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote








|