view Constants.cs @ 108:27b6aa1e98e8

Re #12: Document classes and methods * Document the Constants (Also - test new Hg repo and hooks)
author IBBoard <dev@ibboard.co.uk>
date Sun, 14 Aug 2011 14:34:12 +0100
parents 0f88d32b22cc
children e9f3a4ddf772
line wrap: on
line source

// This file (Constants.cs) is a part of the IBBoard library and is copyright 2009 IBBoard.
//
// The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license.

using System;
using System.IO;

namespace IBBoard
{
	/// <summary>
	/// Summary description for Constants.
	/// </summary>
	public class Constants
	{
		public static readonly char DirectoryChar = Path.DirectorySeparatorChar;
		public static readonly string DirectoryString = Path.DirectorySeparatorChar.ToString();
		private static string executablePath = AppDomain.CurrentDomain.BaseDirectory.TrimEnd(DirectoryChar);

		static Constants()
		{
            string appDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
			string exe = Environment.GetCommandLineArgs()[0];
			exe = Path.GetFileNameWithoutExtension(exe);
            userDataPath = Path.Combine(Path.Combine(appDataDir, "IBBoard"), exe);
		}

		/// <summary>
		/// Gets the path of the directory that contains the executable.
		/// </summary>
		/// <value>
		/// The path that the executable is in.
		/// </value>
		public static string ExecutablePath
		{
			get { return executablePath; }
		}
		
		private static string userDataPath;

		/// <summary>
		/// Gets the standard user data path for this app. This follows a convention of using the app name for the folder
		/// and putting it in a folder called "IBBoard" to avoid collisions.
		/// </summary>
		/// <value>
		/// The user data path, following the IBBoard convention.
		/// </value>
		public static string UserDataPath
		{
			get { return userDataPath; }
		}
	}
}