2.0.0 #92
@@ -364,7 +364,7 @@ public sealed class FileCompactor : IDisposable
|
||||
|
||||
string realPath = path;
|
||||
bool isWine = _dalamudUtilService?.IsWine ?? false;
|
||||
if (isWine)
|
||||
if (isWine && IsProbablyWine())
|
||||
{
|
||||
if (path.StartsWith("Z:\\", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -372,7 +372,6 @@ public sealed class FileCompactor : IDisposable
|
||||
}
|
||||
else if (path.StartsWith("C:\\", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// fallback for Wine's C:\ mapping
|
||||
realPath = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.Personal),
|
||||
path.Substring(3).Replace('\\', '/')
|
||||
@@ -401,7 +400,6 @@ public sealed class FileCompactor : IDisposable
|
||||
return;
|
||||
}
|
||||
|
||||
// 4️⃣ Read process output
|
||||
var stdout = proc.StandardOutput.ReadToEnd();
|
||||
var stderr = proc.StandardError.ReadToEnd();
|
||||
proc.WaitForExit();
|
||||
@@ -531,7 +529,7 @@ public sealed class FileCompactor : IDisposable
|
||||
bool isWine = _dalamudUtilService?.IsWine ?? false;
|
||||
string realPath = path;
|
||||
|
||||
if (isWine)
|
||||
if (isWine && IsProbablyWine())
|
||||
{
|
||||
if (path.StartsWith("Z:\\", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -539,10 +537,7 @@ public sealed class FileCompactor : IDisposable
|
||||
}
|
||||
else if (path.StartsWith("C:\\", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
realPath = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.Personal),
|
||||
path.Substring(3).Replace('\\', '/')
|
||||
).Replace('\\', '/');
|
||||
realPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), path.Substring(3).Replace('\\', '/')).Replace('\\', '/');
|
||||
}
|
||||
|
||||
_logger.LogTrace("Detected Wine environment. Converted path for filefrag: {realPath}", realPath);
|
||||
@@ -632,7 +627,7 @@ public sealed class FileCompactor : IDisposable
|
||||
try
|
||||
{
|
||||
string realPath = path;
|
||||
if (_dalamudUtilService.IsWine)
|
||||
if (_dalamudUtilService.IsWine && IsProbablyWine())
|
||||
{
|
||||
realPath = ConvertWinePathToLinux(path);
|
||||
_logger.LogTrace("Detected Wine environment, remapped path: {realPath}", realPath);
|
||||
@@ -674,7 +669,7 @@ public sealed class FileCompactor : IDisposable
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Error running btrfs defragment for {file}", realPath);
|
||||
_logger.LogWarning(ex, "Error running btrfs defragment for {file}", path);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -758,4 +753,6 @@ public sealed class FileCompactor : IDisposable
|
||||
_logger.LogDebug("Queue has been cancelled by token");
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsProbablyWine() => Environment.GetEnvironmentVariable("WINELOADERNOEXEC") != null || Environment.GetEnvironmentVariable("WINEDLLPATH") != null || Directory.Exists("/proc/self") && File.Exists("/proc/mounts");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user