mirror of
https://github.com/EpicMorg/UniversalValveToolbox.git
synced 2025-05-07 04:09:33 +03:00
environment patch fix
This commit is contained in:
parent
e1cf1fa387
commit
9b45461af3
@ -71,6 +71,9 @@ namespace UniversalValveToolbox {
|
|||||||
|
|
||||||
var indexProject = comboBoxProjects.Items.IndexOf(lastSelectedProject.Name);
|
var indexProject = comboBoxProjects.Items.IndexOf(lastSelectedProject.Name);
|
||||||
comboBoxProjects.SelectedIndex = indexProject;
|
comboBoxProjects.SelectedIndex = indexProject;
|
||||||
|
|
||||||
|
EnvUtils.PrepareVProject($"{SelectedProject?.Path ?? ""}");
|
||||||
|
EnvUtils.PrepareSFMData($"{SelectedProject?.Path ?? ""}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void SaveLastSelectedProject() {
|
private void SaveLastSelectedProject() {
|
||||||
@ -363,11 +366,14 @@ namespace UniversalValveToolbox {
|
|||||||
var selectItem = listView.SelectedItems[0];
|
var selectItem = listView.SelectedItems[0];
|
||||||
|
|
||||||
var selectItemText = selectItem.Text;
|
var selectItemText = selectItem.Text;
|
||||||
|
EnvUtils.PrepareVProject($"{SelectedProject?.Path ?? ""}");
|
||||||
|
EnvUtils.PrepareSFMData($"{SelectedProject?.Path ?? ""}");
|
||||||
|
|
||||||
if (selectItem.Group == listViewGroupTools) {
|
if (selectItem.Group == listViewGroupTools) {
|
||||||
if (RUN_PROJECT_ID.Equals(selectItem.Tag) && SelectedProject != null) {
|
if (RUN_PROJECT_ID.Equals(selectItem.Tag) && SelectedProject != null) {
|
||||||
var pathEngineBin = Path.Combine(SteamPathsUtil.GetSteamAppManifestDataById(SelectedEngine.Appid).Path, SelectedEngine.Bin);
|
var pathEngineBin = Path.Combine(SteamPathsUtil.GetSteamAppManifestDataById(SelectedEngine.Appid).Path, SelectedEngine.Bin);
|
||||||
|
|
||||||
|
|
||||||
Process.Start(pathEngineBin, $"-steam -game \"{SelectedProject?.Path ?? ""}\" {SelectedProject.Args}");
|
Process.Start(pathEngineBin, $"-steam -game \"{SelectedProject?.Path ?? ""}\" {SelectedProject.Args}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,6 +154,7 @@
|
|||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="UI\View\IconComboBoxItem.cs" />
|
<Compile Include="UI\View\IconComboBoxItem.cs" />
|
||||||
|
<Compile Include="Utils\EnvUtils.cs" />
|
||||||
<Compile Include="Utils\JsonFileUtil.cs" />
|
<Compile Include="Utils\JsonFileUtil.cs" />
|
||||||
<Compile Include="Utils\LanguageManager.cs" />
|
<Compile Include="Utils\LanguageManager.cs" />
|
||||||
<Compile Include="Model\Dto\ToolDtoModel.cs" />
|
<Compile Include="Model\Dto\ToolDtoModel.cs" />
|
||||||
|
44
src/UniversalValveToolbox/Utils/EnvUtils.cs
Normal file
44
src/UniversalValveToolbox/Utils/EnvUtils.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
using EpicMorg.SteamPathsLib;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace UniversalValveToolbox.Utils {
|
||||||
|
class EnvUtils {
|
||||||
|
public static void PrepareVProject(string data) {
|
||||||
|
Environment.SetEnvironmentVariable("VProject", data, EnvironmentVariableTarget.User);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void PrepareVMod(string data) {
|
||||||
|
Environment.SetEnvironmentVariable("VMod", data, EnvironmentVariableTarget.User);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void PrepareVGame(string data) {
|
||||||
|
Environment.SetEnvironmentVariable("VGame", data, EnvironmentVariableTarget.User);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void PrepareVContent(string data) {
|
||||||
|
Environment.SetEnvironmentVariable("VContent", data, EnvironmentVariableTarget.User);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void PrepareVTools(string data) {
|
||||||
|
Environment.SetEnvironmentVariable("VTools", data, EnvironmentVariableTarget.User);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void PrepareSFMData(string pathProject) {
|
||||||
|
var SFMpath = SteamPathsUtil.GetSteamAppManifestDataById(1840)?.Path;
|
||||||
|
|
||||||
|
if (SFMpath == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
PrepareVMod(Path.GetDirectoryName(pathProject));
|
||||||
|
PrepareVProject(pathProject);
|
||||||
|
PrepareVContent(Path.Combine(SFMpath, "content"));
|
||||||
|
PrepareVGame(Path.Combine(SFMpath, "game"));
|
||||||
|
PrepareVTools(Path.Combine(SFMpath, "game", "sdktools"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user