From 8c03b6667f9c84e0742540eee083e4630a204525 Mon Sep 17 00:00:00 2001 From: Jarod42 Date: Fri, 15 Nov 2024 21:51:20 +0100 Subject: [PATCH 01/19] [cleanup] Remove unused - FileUtils::GetOSXTerminalCommand - FileUtils::SplitWords - FileUtils::OpenBuiltInTerminal - FileUtils::ParseURI - FileUtils::EscapeString --- CodeLite/fileutils.cpp | 94 ------------------------------------------ CodeLite/fileutils.h | 21 ---------- 2 files changed, 115 deletions(-) diff --git a/CodeLite/fileutils.cpp b/CodeLite/fileutils.cpp index 2c700b56b2..36a77860a6 100644 --- a/CodeLite/fileutils.cpp +++ b/CodeLite/fileutils.cpp @@ -504,28 +504,6 @@ size_t FileUtils::GetFileSize(const wxFileName& filename) } } -wxString FileUtils::EscapeString(const wxString& str) -{ - wxString modstr = str; - modstr.Replace(" ", "\\ "); - modstr.Replace("\"", "\\\""); - return modstr; -} - -wxString FileUtils::GetOSXTerminalCommand(const wxString& command, const wxString& workingDirectory) -{ - wxFileName script(clStandardPaths::Get().GetBinFolder(), "osx-terminal.sh"); - - wxString cmd; - cmd << EscapeString(script.GetFullPath()) << " \""; - if (!workingDirectory.IsEmpty()) { - cmd << "cd " << EscapeString(workingDirectory) << " && "; - } - cmd << EscapeString(command) << "\""; - clDEBUG() << "GetOSXTerminalCommand returned:" << cmd << clEndl; - return cmd; -} - wxString FileUtils::NormaliseName(const wxString& name) { static bool initialised = false; @@ -583,17 +561,6 @@ bool FileUtils::NextWord(const wxString& str, size_t& offset, wxString& word, bo return false; } -size_t FileUtils::SplitWords(const wxString& str, wxStringSet_t& outputSet, bool makeLower) -{ - size_t offset = 0; - wxString word; - outputSet.clear(); - while (NextWord(str, offset, word, makeLower)) { - outputSet.insert(word); - } - return outputSet.size(); -} - bool FileUtils::RemoveFile(const wxString& filename, const wxString& context) { LOG_IF_TRACE { clDEBUG1() << "Deleting file:" << filename << "(" << context << ")"; } @@ -650,30 +617,6 @@ wxString FileUtils::RealPath(const wxString& filepath) return filepath; } -void FileUtils::OpenBuiltInTerminal(const wxString& wd, const wxString& user_command, bool pause_when_exit) -{ - wxString title(user_command); - - wxFileName fnCodeliteTerminal(clStandardPaths::Get().GetExecutablePath()); - fnCodeliteTerminal.SetFullName("codelite-terminal"); - - wxString newCommand; - newCommand << fnCodeliteTerminal.GetFullPath() << " --exit "; - if (pause_when_exit) { - newCommand << " --wait "; - } - if (wxDirExists(wd)) { - wxString workingDirectory = wd; - workingDirectory.Trim().Trim(false); - if (workingDirectory.Contains(" ") && !workingDirectory.StartsWith("\"")) { - workingDirectory.Prepend("\"").Append("\""); - } - newCommand << " --working-directory " << wd; - } - newCommand << " --cmd " << title; - ::wxExecute(newCommand, wxEXEC_ASYNC); -} - std::string FileUtils::ToStdString(const wxString& str) { return StringUtils::ToStdString(str); } bool FileUtils::ReadBufferFromFile(const wxFileName& fn, wxString& data, size_t bufferSize) @@ -851,43 +794,6 @@ size_t FileUtils::FindSimilar(const wxFileName& filename, const std::vector