Skip to content

Commit

Permalink
Fix path for PublishSingleFile
Browse files Browse the repository at this point in the history
  • Loading branch information
Virenbar committed May 28, 2023
1 parent 4bcfac9 commit deb32be
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
24 changes: 17 additions & 7 deletions GDPIControl/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,26 @@ namespace GDPIControl
{
internal static class Constants
{
public const string BlacklistName = "Blacklist.txt";
public const string UserlistName = "Userlist.txt";
private const string BlacklistName = "Blacklist.txt";
private const string BlacklistTempName = "Blacklist.temp.txt";
private const string ConfigName = "Config.xml";
private const string NBLName = "Blacklist.temp.txt";
private const string UserlistName = "Userlist.txt";
private const string x86 = @"GDPI\x86\goodbyedpi.exe";
private const string x86_64 = @"GDPI\x86_64\goodbyedpi.exe";
public static string BlacklistPath => Path.Combine(Application.StartupPath, BlacklistName);
public static string BlacklistTempPath => Path.Combine(Application.StartupPath, NBLName);
public static string ConfigPath => Path.Combine(Application.StartupPath, ConfigName);
public static string BlacklistPath => Path.Combine(StartupPath, BlacklistName);
public static string BlacklistTempPath => Path.Combine(StartupPath, BlacklistTempName);
public static string ConfigPath => Path.Combine(StartupPath, ConfigName);

/// <summary>
/// .NET 6 uses TEMP directory for GDPI
/// </summary>
public static string GDPIPath => Path.Combine(Application.StartupPath, Environment.Is64BitOperatingSystem ? x86_64 : x86);
public static string UserlistPath => Path.Combine(Application.StartupPath, UserlistName);

#if NET6_0_OR_GREATER
public static string StartupPath => Path.GetDirectoryName(Environment.ProcessPath);
#else
public static string StartupPath => Application.StartupPath;
#endif
public static string UserlistPath => Path.Combine(StartupPath, UserlistName);
}
}
4 changes: 2 additions & 2 deletions GDPIControl/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ private void SetArguments()
{
Arguments = GDPISettings.ModesetArgument(Settings.Modeset);
}
if (Settings.UseBlacklist) { Arguments += $" --blacklist {Constants.BlacklistName}"; }
if (Settings.UseUserlist) { Arguments += $" --blacklist {Constants.UserlistName}"; }
if (Settings.UseBlacklist) { Arguments += $@" --blacklist ""{Constants.BlacklistPath}"""; }
if (Settings.UseUserlist) { Arguments += $@" --blacklist ""{Constants.UserlistPath}"""; }
Settings.Arguments = Arguments;

B_Copy.Enabled = Settings.Modeset != Modeset.Custom;
Expand Down
2 changes: 1 addition & 1 deletion GDPIControl/Properties/PublishProfiles/net6.pubxml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<PublishDir>publish\net6.0-windows\</PublishDir>
<PublishSingleFile>false</PublishSingleFile>
<PublishSingleFile>true</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
<SelfContained>false</SelfContained>
</PropertyGroup>
Expand Down

0 comments on commit deb32be

Please sign in to comment.