[Globals] Make exe directory a global value

This commit is contained in:
Matt Nadareski
2017-03-29 12:49:34 -07:00
parent c53635b623
commit 997772de2e
3 changed files with 18 additions and 5 deletions

View File

@@ -1,4 +1,11 @@
using System.Threading.Tasks;
using System.Reflection;
using System.Threading.Tasks;
#if MONO
using System.IO;
#else
using Alphaleonis.Win32.Filesystem;
#endif
namespace SabreTools.Helper.Data
{
@@ -8,6 +15,7 @@ namespace SabreTools.Helper.Data
private static Logger _logger = null;
private static int _maxDegreeOfParallelism = 4;
private static string _exeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
#endregion
@@ -39,6 +47,13 @@ namespace SabreTools.Helper.Data
};
}
}
public static string ExeDir
{
get
{
return _exeDir;
}
}
#endregion
}

View File

@@ -1,5 +1,4 @@
using System;
using System.Reflection;
using SabreTools.Helper.Data;
@@ -33,7 +32,7 @@ namespace SabreTools.Helper
private StreamWriter _log;
// Private required variables
private string _basepath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase), "logs") + Path.DirectorySeparatorChar;
private string _basepath = Path.Combine(Globals.ExeDir, "logs") + Path.DirectorySeparatorChar;
/// <summary>
/// Initialize a console-only logger object

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
using System.Xml;
using SabreTools.Helper.Data;
@@ -31,7 +30,7 @@ namespace SabreTools.Helper.Skippers
public string SourceFile;
// Local paths
public static string LocalPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase), "Skippers") + Path.DirectorySeparatorChar;
public static string LocalPath = Path.Combine(Globals.ExeDir, "Skippers") + Path.DirectorySeparatorChar;
// Header skippers represented by a list of skipper objects
private static List<Skipper> _list;