Skip to content
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

Try to avoid tempfile collisions in more places #1419

Merged
merged 1 commit into from
Nov 1, 2023
Merged
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
2 changes: 1 addition & 1 deletion src/XIVLauncher.Common.Unix/Compatibility/Dxvk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static async Task InstallDxvk(DirectoryInfo prefix, DirectoryInfo install
private static async Task DownloadDxvk(DirectoryInfo installDirectory)
{
using var client = new HttpClient();
var tempPath = Path.GetTempFileName();
var tempPath = PlatformHelpers.GetTempFileName();

File.WriteAllBytes(tempPath, await client.GetByteArrayAsync(DXVK_DOWNLOAD));
PlatformHelpers.Untar(tempPath, installDirectory.FullName);
Expand Down
2 changes: 1 addition & 1 deletion src/XIVLauncher.Common/Dalamud/AssetManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public class Asset

var packageUrl = info.PackageUrl;

var tempPath = Path.GetTempFileName();
var tempPath = PlatformHelpers.GetTempFileName();

if (File.Exists(tempPath))
File.Delete(tempPath);
Expand Down
2 changes: 1 addition & 1 deletion src/XIVLauncher.Common/Util/PlatformHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static Platform GetPlatform()
public static string GetTempFileName()
{
// https://stackoverflow.com/a/50413126
return Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
return Path.Combine(Path.GetTempPath(), "xivlauncher_" + Guid.NewGuid());
}

public static void DeleteAndRecreateDirectory(DirectoryInfo dir)
Expand Down