Skip to content
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
26 changes: 17 additions & 9 deletions src/FeatureIssues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1358,11 +1358,15 @@ namespace FeatureIssues
for (const auto& testInfo : testInis) {
try {
if (testInfo.isNewFile) {
// Remove the test INI file we created
if (std::filesystem::exists(testInfo.testIniPath)) {
std::filesystem::remove(testInfo.testIniPath);
logger::debug("Removed test INI: {}", testInfo.testIniPath);
}
// Remove the test INI file we created.
std::error_code ec; // Use the error_code overload to avoid exceptions for non-critical errors like the file not existing.
if (const bool removed = std::filesystem::remove(testInfo.testIniPath, ec); ec) {
logger::warn("Error while trying to delete {}: {}", testInfo.testIniPath, ec.message());
success = false;
} else if (removed) {
// Successfully deleted.
logger::debug("Deleted {}", testInfo.testIniPath);
} // If !removed and no error, the file didn't exist, which is fine.
} else {
// Restore original version using INI functions
CSimpleIniA ini;
Expand Down Expand Up @@ -1395,13 +1399,17 @@ namespace FeatureIssues
}
} // Clear the active test INIs tracking and remove persistent state
s_activeTestInis.clear();
const auto stateFilePath = GetTestStateFilePath();
const auto& stateFilePathString = Util::WStringToString(stateFilePath);
try {
const auto stateFilePath = GetTestStateFilePath();
if (std::filesystem::exists(stateFilePath)) {
std::filesystem::remove(stateFilePath);
bool removed = std::filesystem::remove(stateFilePath);
if (!removed) {
logger::warn("Failed to delete file {}", stateFilePathString);
} else {
logger::debug("Deleted {}", stateFilePathString);
}
} catch (const std::exception& e) {
logger::warn("Failed to remove persistent test state file: {}", e.what());
logger::warn("Expected to delete {}, but ran into exception: {}", stateFilePathString, e.what());
}
// Clear existing feature issues and rescan to update UI immediately
// This ensures the restored state is reflected without requiring a restart
Expand Down
16 changes: 6 additions & 10 deletions src/ShaderCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1923,16 +1923,12 @@ namespace SIE
const auto& filePathString = Util::WStringToString(filePath);
{
std::scoped_lock lockD{ compilationSet.compilationMutex };
try {
if (std::filesystem::exists(filePath)) {
std::filesystem::remove(filePath);
logger::debug("Deleted {}", filePathString);
}
} catch (const std::exception& e) {
logger::warn("Failed to delete file {}: {}", filePathString, e.what());
} catch (...) {
logger::warn("An unknown error occurred while trying to delete file '{}'", filePathString);
}
std::error_code ec; // Use the error_code overload to avoid exceptions for non-critical errors like the file not existing.
if (const bool removed = std::filesystem::remove(filePath, ec); ec) {
logger::warn("Error while trying to delete {}: {}", filePathString, ec.message());
} else if (removed) {
logger::debug("Deleted {}", filePathString);
} // If !removed and no error, the file didn't exist, which is fine.
}

logger::debug("Marking recompile for shader: {}", entry.key);
Expand Down