thememan: Check for portable-mode file in the application directory.
Fixes #1902
This commit is contained in:
parent
a524adc698
commit
552b2b1315
|
@ -42,13 +42,27 @@ namespace thememan
|
||||||
|
|
||||||
OpenFileDialog importDialog;
|
OpenFileDialog importDialog;
|
||||||
|
|
||||||
|
static bool IsPortable(out string directory)
|
||||||
|
{
|
||||||
|
System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
|
||||||
|
directory = asm != null ? asm.Location : string.Empty;
|
||||||
|
if (string.IsNullOrEmpty(directory))
|
||||||
|
{
|
||||||
|
directory = string.Empty;
|
||||||
|
return File.Exists("portable-mode");
|
||||||
|
}
|
||||||
|
directory = Path.GetDirectoryName(directory);
|
||||||
|
return File.Exists(Path.Combine(directory, "portable-mode"));
|
||||||
|
}
|
||||||
|
|
||||||
public HTM ()
|
public HTM ()
|
||||||
{
|
{
|
||||||
InitializeComponent ();
|
InitializeComponent ();
|
||||||
|
string portableDir;
|
||||||
|
|
||||||
if (RunningOnWindows() && File.Exists("portable-mode"))
|
if (RunningOnWindows() && IsPortable(out portableDir))
|
||||||
{
|
{
|
||||||
hexchatdir = ("config\\");
|
hexchatdir = Path.Combine(portableDir, "config\\");
|
||||||
|
|
||||||
if (!Directory.Exists(hexchatdir))
|
if (!Directory.Exists(hexchatdir))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue