Use user data folder for template cache and logging.

pull/1089/head
Halil ibrahim Kalkan 7 years ago
parent 37ce88c29e
commit e557914459

@ -0,0 +1,13 @@
using System;
using System.IO;
namespace Volo.Abp.Cli
{
public static class CliPaths
{
public static string TemplateCachePath => Path.Combine(AbpRootPath, "templates");
public static string CliLogPath => Path.Combine(AbpRootPath, "cli", "logs");
private static readonly string AbpRootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".abp");
}
}

@ -3,6 +3,7 @@ using System.IO;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Volo.Abp.Cli;
using Volo.Abp.DependencyInjection;
using Volo.Abp.IO;
@ -19,7 +20,7 @@ namespace Volo.Abp.ProjectBuilding
public async Task<TemplateFile> GetAsync(string templateName, string version)
{
var localCacheFolder = "C:\\Temp\\abp-template-cache\\" + version;
var localCacheFolder = Path.Combine(CliPaths.TemplateCachePath, version);
DirectoryHelper.CreateIfNotExists(localCacheFolder);
var localCacheFile = Path.Combine(localCacheFolder, templateName + ".zip");

@ -1,6 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using Serilog;
using Serilog.Events;
using System.IO;
using Volo.Abp.Threading;
namespace Volo.Abp.Cli
@ -13,7 +14,7 @@ namespace Volo.Abp.Cli
.MinimumLevel.Information()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.Enrich.FromLogContext()
//.WriteTo.File("Logs/logs.txt") //TODO: Write logs to a global path
.WriteTo.File(Path.Combine(CliPaths.CliLogPath, "abp-cli-logs.txt"))
.WriteTo.Console()
.CreateLogger();

Loading…
Cancel
Save