1
0
mirror of synced 2025-02-20 20:41:16 +01:00

Prepare for single file deployment

This commit is contained in:
Yuchen Ji 2022-04-05 16:37:33 +08:00
parent 359ccd5678
commit 2ef837841f
2 changed files with 12 additions and 13 deletions

View File

@ -87,13 +87,19 @@ internal class Program
private static void LogConfigValues()
{
var log = $"Config values: {nameof(Configs.SE_COUNT)} : {Configs.SE_COUNT}\n" +
var configs = $"Config values: {nameof(Configs.SE_COUNT)} : {Configs.SE_COUNT}\n" +
$"{nameof(Configs.ITEM_COUNT)} : {Configs.ITEM_COUNT}\n" +
$"{nameof(Configs.SKIN_COUNT)} : {Configs.SKIN_COUNT}\n" +
$"{nameof(Configs.TITLE_COUNT)} : {Configs.TITLE_COUNT}\n" +
$"{nameof(Configs.AVATAR_COUNT)} : {Configs.AVATAR_COUNT}\n" +
$"{nameof(Configs.NAVIGATOR_COUNT)} : {Configs.NAVIGATOR_COUNT}\n" +
$"{nameof(Configs.MUSIC_DB_NAME)} : {Configs.MUSIC_DB_NAME}\n";
log.Info();
configs.Info();
var paths = $"Paths: {nameof(PathHelper.HtmlRootPath)}: {PathHelper.HtmlRootPath}\n" +
$"{nameof(PathHelper.LogRootPath)}: {PathHelper.LogRootPath}\n" +
$"{nameof(PathHelper.DataBaseRootPath)}: {PathHelper.DataBaseRootPath}\n";
paths.Info();
}
}

View File

@ -1,5 +1,4 @@
using System.Diagnostics;
using Swan;
namespace GCLocalServerRewrite.common;
@ -21,24 +20,18 @@ public static class PathHelper
{
get
{
var assemblyPath = Path.GetDirectoryName(typeof(Program).Assembly.Location);
var assemblyPath = AppContext.BaseDirectory;
#if DEBUG
Debug.Assert(assemblyPath != null, $"{nameof(assemblyPath)} != null");
var parentFullName = Directory.GetParent(assemblyPath)?.Parent?.Parent?.FullName;
var parentFullName = Directory.GetParent(assemblyPath)?.Parent?.Parent?.Parent?.FullName;
Debug.Assert(parentFullName != null, $"{nameof(parentFullName)} != null");
return parentFullName;
#else
if (assemblyPath != null)
{
return assemblyPath;
}
throw SelfCheck.Failure("Cannot get assembly path!");
return AppContext.BaseDirectory;
#endif
}
}