Skip to content

for portability and improved OOB experience use exe path as data path #573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 4 additions & 48 deletions BorderlessGaming.Logic/System/AppEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,54 +20,10 @@ public static string DataPath
{
get
{
var versionInfo = FileVersionInfo.GetVersionInfo(Path);
var userAppData = GetUserAppDataPath();
try
{
// No version!
return Environment.GetEnvironmentVariable("AppData").Trim() + "\\" + versionInfo.CompanyName +
"\\" + versionInfo.ProductName;
}
catch
{
}

try
{
// Version, but chopped out
return userAppData.Substring(0, userAppData.LastIndexOf("\\"));
}
catch
{
try
{
// App launch folder
var directoryInfo = new FileInfo(Path).Directory;
var dir = directoryInfo.ToString();
return Path.Substring(0, dir.LastIndexOf("\\", StringComparison.Ordinal));
}
catch
{
try
{
// Current working folder
return Environment.CurrentDirectory;
}
catch
{
try
{
// Desktop
return Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
}
catch
{
// Also current working folder
return ".";
}
}
}
}
var exeLoc = Assembly.GetExecutingAssembly().Location;
var exeLocFull = global::System.IO.Path.GetFullPath(exeLoc);
var exeFolderPath = global::System.IO.Path.GetDirectoryName(exeLocFull);
return exeFolderPath;
}
}

Expand Down
8 changes: 5 additions & 3 deletions BorderlessGaming/BorderlessGaming.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,11 @@
$(PostBuildEventDependsOn);
PostBuildMacros;
</PostBuildEventDependsOn>
<PostBuildEvent>call signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /as /sha1 3BD5BE571287FE2052F137C44198AE7BAB38B037 "$(ProjectDir)$(OutDir)$(TargetFileName)"
call iscc /Qp "$(SolutionDir)\Installers\BorderlessGaming_Standalone_Admin.iss"
call signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /as /sha1 3BD5BE571287FE2052F137C44198AE7BAB38B037 "$(SolutionDir)Installers\BorderlessGaming@(VersionNumber)_admin_setup.exe"</PostBuildEvent>
<PostBuildEvent>Xcopy /E /H /C /I "$(SolutionDir)Languages" "$(ProjectDir)$(OutDir)Languages"

rem call "C:\Program Files (x86)\Windows Kits\10\App Certification Kit\signtool" sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /as /sha1 3BD5BE571287FE2052F137C44198AE7BAB38B037 "$(ProjectDir)$(OutDir)$(TargetFileName)"
rem call iscc /Qp "$(SolutionDir)\Installers\BorderlessGaming_Standalone_Admin.iss"
rem call "C:\Program Files (x86)\Windows Kits\10\App Certification Kit\signtool" sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /as /sha1 3BD5BE571287FE2052F137C44198AE7BAB38B037 "$(SolutionDir)Installers\BorderlessGaming@(VersionNumber)_admin_setup.exe"</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>copy $(SolutionDir)SteamLibs\* $(ProjectDir)$(OutDir)</PreBuildEvent>
Expand Down