Skip to content

Commit

Permalink
reduce binary file size by enabling single file mode
Browse files Browse the repository at this point in the history
  • Loading branch information
atauenis committed Mar 11, 2024
1 parent 0d1edbc commit 1d06d8f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions HttpTransit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -970,8 +970,8 @@ private void SendInternalPage(string InternalPageId)
{
if (!File.Exists(Src))
{
if (File.Exists(new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName + Path.DirectorySeparatorChar + Src))
Src = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName + Path.DirectorySeparatorChar + Src;
if (File.Exists(new FileInfo(AppContext.BaseDirectory).DirectoryName + Path.DirectorySeparatorChar + Src))
Src = new FileInfo(AppContext.BaseDirectory).DirectoryName + Path.DirectorySeparatorChar + Src;
else
throw new FileNotFoundException("No such file: " + Src);
}
Expand Down
6 changes: 3 additions & 3 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static void Main(string[] args)
Assembly.GetExecutingAssembly().GetName().Version.Major + "." +
Assembly.GetExecutingAssembly().GetName().Version.Minor + "." +
Assembly.GetExecutingAssembly().GetName().Version.Build
//+ "-pre"
+ "-pre"
);
Variables.Add("WOSystem", Environment.OSVersion.ToString());

Expand Down Expand Up @@ -1023,7 +1023,7 @@ public static string GetConfigurationFileName()
default:
case PlatformID.Unix:
CurrentDirConfigFile = "./webone.conf";
DefaultConfigFile = new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName + "/webone.conf";
DefaultConfigFile = new FileInfo(AppContext.BaseDirectory).DirectoryName + "/webone.conf";
UserConfigFile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "/.config/webone/webone.conf";
CommonConfigFile = "/etc/webone.conf";

Expand All @@ -1034,7 +1034,7 @@ public static string GetConfigurationFileName()
break;
case PlatformID.Win32NT:
CurrentDirConfigFile = @".\webone.conf";
DefaultConfigFile = new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName + @"\webone.conf";
DefaultConfigFile = new FileInfo(AppContext.BaseDirectory).DirectoryName + @"\webone.conf";
UserConfigFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\WebOne\webone.conf";
CommonConfigFile = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\WebOne\webone.conf";
break;
Expand Down
13 changes: 11 additions & 2 deletions WebOne.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Authors>Alexander Tauenis</Authors>
<Version>0.16.3</Version>
<VersionSuffix></VersionSuffix> <!--<VersionSuffix>-pre</VersionSuffix>-->
<Version>0.17.0</Version>
<VersionSuffix>-pre</VersionSuffix> <!--<VersionSuffix>-pre</VersionSuffix>-->
<PackageVersion>$(Version)$(VersionSuffix)</PackageVersion>
<Company>World</Company>
<Product>WebOne HTTP Proxy Server</Product>
Expand Down Expand Up @@ -45,6 +45,15 @@
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>

<PropertyGroup>
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>

<PropertyGroup Condition="$(SelfContained)==true">
<PublishTrimmed>true</PublishTrimmed>
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
</PropertyGroup>

<PropertyGroup Condition="$(Configuration)=='Release' AND !$(RuntimeIdentifier.Contains('linux-arm'))">
<SelfContained>False</SelfContained>
</PropertyGroup>
Expand Down

0 comments on commit 1d06d8f

Please sign in to comment.