Return to Snippet

Revision: 52230
at October 17, 2011 07:42 by jimfred


Updated Code
// Evaluates to something of the form "C:\AppDirectory\AppName.cfg".

static private string filename = System.Text.RegularExpressions.Regex.Replace( Application.ExecutablePath, "\\.exe$", ".cfg", System.Text.RegularExpressions.RegexOptions.IgnoreCase );

Revision: 52229
at October 17, 2011 07:39 by jimfred


Initial Code
...
static private string filename = System.Text.RegularExpressions.Regex.Replace( Application.ExecutablePath, "\\.exe$", ".cfg", System.Text.RegularExpressions.RegexOptions.IgnoreCase );

Initial URL

                                

Initial Description
Single-line expression provides .CFG filename based on application name.
The .CFG file is in the same directory as the application.
Application.ExecutablePath returns the app's path, with directory, including the trailing .EXE.
Regex is used to replace the .EXE with a .CFG or .INI

Initial Title
Get .CFG or .INI filename based on current application name

Initial Tags

                                

Initial Language
C#