Remove path sanitize for file drops (#611)

This commit is contained in:
Garrett Cox
2024-05-30 15:01:55 -05:00
committed by GitHub
parent 3590cfa118
commit 74afca9bf7
+1 -20
View File
@@ -408,25 +408,6 @@ extern "C" void OTRExtScanner() {
}
}
std::string SanitizePath(std::string stringValue) {
// Add backslashes.
for (auto i = stringValue.begin();;) {
auto const pos =
std::find_if(i, stringValue.end(), [](char const c) { return '\\' == c || '\'' == c || '"' == c; });
if (pos == stringValue.end()) {
break;
}
i = std::next(stringValue.insert(pos, '\\'), 2);
}
// Removes others.
stringValue.erase(std::remove_if(stringValue.begin(), stringValue.end(),
[](char const c) { return '\n' == c || '\r' == c || '\0' == c || '\x1A' == c; }),
stringValue.end());
return stringValue;
}
void Ben_ProcessDroppedFiles(std::string filePath) {
SPDLOG_INFO("Processing dropped file: {}", filePath);
@@ -676,7 +657,7 @@ extern "C" void Graph_StartFrame() {
#endif
if (CVarGetInteger(CVAR_NEW_FILE_DROPPED, 0)) {
std::string filePath = SanitizePath(CVarGetString(CVAR_DROPPED_FILE, ""));
std::string filePath = CVarGetString(CVAR_DROPPED_FILE, "");
if (!filePath.empty()) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnFileDropped>(filePath);
}