mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 23:03:51 +02:00
Path.Join()
This commit is contained in:
@@ -24,16 +24,16 @@ namespace VRCX
|
||||
{
|
||||
const string vrchatAppid = "438100";
|
||||
_homeDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
_steamPath = Path.Combine(_homeDirectory, ".local/share/Steam");
|
||||
var flatpakSteamPath = Path.Combine(_homeDirectory, ".var/app/com.valvesoftware.Steam/.local/share/Steam");
|
||||
_steamPath = Path.Join(_homeDirectory, ".local/share/Steam");
|
||||
var flatpakSteamPath = Path.Join(_homeDirectory, ".var/app/com.valvesoftware.Steam/.local/share/Steam");
|
||||
if (!Directory.Exists(_steamPath) && Directory.Exists(flatpakSteamPath))
|
||||
{
|
||||
logger.Info("Flatpak Steam detected.");
|
||||
_steamPath = flatpakSteamPath;
|
||||
}
|
||||
_steamUserdataPath = Path.Combine(_homeDirectory, ".steam/steam/userdata");
|
||||
_steamUserdataPath = Path.Join(_homeDirectory, ".steam/steam/userdata");
|
||||
|
||||
var libraryFoldersVdfPath = Path.Combine(_steamPath, "config/libraryfolders.vdf");
|
||||
var libraryFoldersVdfPath = Path.Join(_steamPath, "config/libraryfolders.vdf");
|
||||
var vrcLibraryPath = GetLibraryWithAppId(libraryFoldersVdfPath, vrchatAppid);
|
||||
if (string.IsNullOrEmpty(vrcLibraryPath))
|
||||
{
|
||||
@@ -41,8 +41,8 @@ namespace VRCX
|
||||
vrcLibraryPath = _steamPath;
|
||||
}
|
||||
logger.Info($"Using steam library path {vrcLibraryPath}");
|
||||
_vrcPrefixPath = Path.Combine(vrcLibraryPath, $"steamapps/compatdata/{vrchatAppid}/pfx");
|
||||
_vrcAppDataPath = Path.Combine(_vrcPrefixPath, "drive_c/users/steamuser/AppData/LocalLow/VRChat/VRChat");
|
||||
_vrcPrefixPath = Path.Join(vrcLibraryPath, $"steamapps/compatdata/{vrchatAppid}/pfx");
|
||||
_vrcAppDataPath = Path.Join(_vrcPrefixPath, "drive_c/users/steamuser/AppData/LocalLow/VRChat/VRChat");
|
||||
}
|
||||
|
||||
private static string? GetLibraryWithAppId(string libraryFoldersVdfPath, string appId)
|
||||
@@ -91,12 +91,12 @@ namespace VRCX
|
||||
}
|
||||
}
|
||||
|
||||
return Path.Combine(GetVRChatAppDataLocation(), "Cache-WindowsPlayer");
|
||||
return Path.Join(GetVRChatAppDataLocation(), "Cache-WindowsPlayer");
|
||||
}
|
||||
|
||||
public override string GetVRChatPhotosLocation()
|
||||
{
|
||||
return Path.Combine(_vrcPrefixPath, "drive_c/users/steamuser/Pictures/VRChat");
|
||||
return Path.Join(_vrcPrefixPath, "drive_c/users/steamuser/Pictures/VRChat");
|
||||
}
|
||||
|
||||
public override string GetUGCPhotoLocation(string path = "")
|
||||
@@ -138,7 +138,7 @@ namespace VRCX
|
||||
public override string GetVRChatScreenshotsLocation()
|
||||
{
|
||||
// program files steam userdata screenshots
|
||||
return Path.Combine(_steamUserdataPath, "760/remote/438100/screenshots");
|
||||
return Path.Join(_steamUserdataPath, "760/remote/438100/screenshots");
|
||||
}
|
||||
|
||||
public override bool OpenVrcxAppDataFolder()
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace VRCX
|
||||
return false;
|
||||
}
|
||||
|
||||
var steamExecutable = Path.Combine(steamPath, "steam.sh");
|
||||
var steamExecutable = Path.Join(steamPath, "steam.sh");
|
||||
if (!File.Exists(steamExecutable))
|
||||
{
|
||||
logger.Error("Steam executable not found.");
|
||||
@@ -105,7 +105,7 @@ namespace VRCX
|
||||
public override bool StartGameFromPath(string path, string arguments)
|
||||
{
|
||||
if (!path.EndsWith(".exe"))
|
||||
path = Path.Combine(path, "launch.exe");
|
||||
path = Path.Join(path, "launch.exe");
|
||||
|
||||
if (!path.EndsWith("launch.exe") || !File.Exists(path))
|
||||
return false;
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace VRCX
|
||||
private static string GetSteamVdfCompatTool()
|
||||
{
|
||||
string steamPath = _steamPath;
|
||||
string configVdfPath = Path.Combine(steamPath, "config", "config.vdf");
|
||||
string configVdfPath = Path.Join(steamPath, "config", "config.vdf");
|
||||
if (!File.Exists(configVdfPath))
|
||||
{
|
||||
logger.Error("config.vdf not found");
|
||||
@@ -240,14 +240,14 @@ namespace VRCX
|
||||
}
|
||||
|
||||
string steamPath = _steamPath;
|
||||
string steamAppsCommonPath = Path.Combine(steamPath, "steamapps", "common");
|
||||
string compatabilityToolsPath = Path.Combine(steamPath, "compatibilitytools.d");
|
||||
string protonPath = Path.Combine(steamAppsCommonPath, compatTool);
|
||||
string compatToolPath = Path.Combine(compatabilityToolsPath, compatTool);
|
||||
string steamAppsCommonPath = Path.Join(steamPath, "steamapps", "common");
|
||||
string compatabilityToolsPath = Path.Join(steamPath, "compatibilitytools.d");
|
||||
string protonPath = Path.Join(steamAppsCommonPath, compatTool);
|
||||
string compatToolPath = Path.Join(compatabilityToolsPath, compatTool);
|
||||
string winePath = "";
|
||||
if (Directory.Exists(compatToolPath))
|
||||
{
|
||||
winePath = Path.Combine(compatToolPath, "files", "bin", "wine");
|
||||
winePath = Path.Join(compatToolPath, "files", "bin", "wine");
|
||||
if (!File.Exists(winePath))
|
||||
{
|
||||
Console.WriteLine("Wine not found in CompatTool path");
|
||||
@@ -256,7 +256,7 @@ namespace VRCX
|
||||
}
|
||||
else if (Directory.Exists(protonPath))
|
||||
{
|
||||
winePath = Path.Combine(protonPath, "dist", "bin", "wine");
|
||||
winePath = Path.Join(protonPath, "dist", "bin", "wine");
|
||||
if (!File.Exists(winePath))
|
||||
{
|
||||
logger.Error("Wine not found in Proton path");
|
||||
@@ -270,7 +270,7 @@ namespace VRCX
|
||||
{
|
||||
if (dir.Contains(compatTool))
|
||||
{
|
||||
winePath = Path.Combine(dir, "files", "bin", "wine");
|
||||
winePath = Path.Join(dir, "files", "bin", "wine");
|
||||
if (File.Exists(winePath))
|
||||
{
|
||||
break;
|
||||
@@ -338,7 +338,7 @@ namespace VRCX
|
||||
private string GetWineRegCommandEx(string regCommand)
|
||||
{
|
||||
string winePrefix = _vrcPrefixPath;
|
||||
string filePath = Path.Combine(winePrefix, "user.reg");
|
||||
string filePath = Path.Join(winePrefix, "user.reg");
|
||||
if (!File.Exists(filePath))
|
||||
throw new FileNotFoundException($"Registry file not found at {filePath}");
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace VRCX
|
||||
{
|
||||
var winePrefix = Path.Join(_vrcPrefixPath, "drive_c");
|
||||
var winePath = path.Substring(3).Replace("\\", "/");
|
||||
path = Path.Combine(winePrefix, winePath);
|
||||
path = Path.Join(winePrefix, winePath);
|
||||
|
||||
var fileName = Path.GetFileNameWithoutExtension(path);
|
||||
if (!File.Exists(path) || !path.EndsWith(".png") || !fileName.StartsWith("VRChat_"))
|
||||
@@ -25,7 +25,7 @@ namespace VRCX
|
||||
if (changeFilename)
|
||||
{
|
||||
var newFileName = $"{fileName}_{worldId}";
|
||||
var newPath = Path.Combine(Path.GetDirectoryName(path), newFileName + Path.GetExtension(path));
|
||||
var newPath = Path.Join(Path.GetDirectoryName(path), newFileName + Path.GetExtension(path));
|
||||
File.Move(path, newPath);
|
||||
path = newPath;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user