mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-14 11:39:16 +08:00
Merge pull request #19 from jjw24/enable_portable_mode
Enable portable mode
This commit is contained in:
commit
91be43169c
@ -1,4 +1,4 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using NLog;
|
using NLog;
|
||||||
@ -22,8 +22,7 @@ namespace Wox.Infrastructure.Logger
|
|||||||
var configuration = new LoggingConfiguration();
|
var configuration = new LoggingConfiguration();
|
||||||
var target = new FileTarget();
|
var target = new FileTarget();
|
||||||
configuration.AddTarget("file", target);
|
configuration.AddTarget("file", target);
|
||||||
target.FileName = "${specialfolder:folder=ApplicationData}/" + Constant.Wox + "/" + DirectoryName + "/" +
|
target.FileName = path.Replace(@"\", "/") + "/${shortdate}.txt";
|
||||||
Constant.Version + "/${shortdate}.txt";
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
var rule = new LoggingRule("*", LogLevel.Debug, target);
|
var rule = new LoggingRule("*", LogLevel.Debug, target);
|
||||||
#else
|
#else
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@ -7,13 +7,26 @@ namespace Wox.Infrastructure
|
|||||||
{
|
{
|
||||||
public static class Constant
|
public static class Constant
|
||||||
{
|
{
|
||||||
|
public static string DetermineDataDirectory()
|
||||||
|
{
|
||||||
|
string portableDataPath = Path.Combine(ProgramDirectory, "UserData");
|
||||||
|
if (Directory.Exists(portableDataPath))
|
||||||
|
{
|
||||||
|
return portableDataPath;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Wox);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public const string Wox = "Wox";
|
public const string Wox = "Wox";
|
||||||
public const string Plugins = "Plugins";
|
public const string Plugins = "Plugins";
|
||||||
|
|
||||||
private static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
|
private static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
|
||||||
public static readonly string ProgramDirectory = Directory.GetParent(Assembly.Location.NonNull()).ToString();
|
public static readonly string ProgramDirectory = Directory.GetParent(Assembly.Location.NonNull()).ToString();
|
||||||
public static readonly string ExecutablePath = Path.Combine(ProgramDirectory, Wox + ".exe");
|
public static readonly string ExecutablePath = Path.Combine(ProgramDirectory, Wox + ".exe");
|
||||||
public static readonly string DataDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Wox);
|
public static readonly string DataDirectory = DetermineDataDirectory();
|
||||||
public static readonly string PluginsDirectory = Path.Combine(DataDirectory, Plugins);
|
public static readonly string PluginsDirectory = Path.Combine(DataDirectory, Plugins);
|
||||||
public static readonly string PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins);
|
public static readonly string PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins);
|
||||||
public const string Repository = "https://github.com/Wox-launcher/Wox";
|
public const string Repository = "https://github.com/Wox-launcher/Wox";
|
||||||
|
Loading…
Reference in New Issue
Block a user