1 /* 2 * RSessionUtils.hpp 3 * 4 * Copyright (C) 2021 by RStudio, PBC 5 * 6 * Unless you have received this program directly from RStudio pursuant 7 * to the terms of a commercial license agreement with RStudio, then 8 * this program is licensed to you under the terms of version 3 of the 9 * GNU Affero General Public License. This program is distributed WITHOUT 10 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the 12 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details. 13 * 14 */ 15 16 #ifndef R_SESSION_UTILS_HPP 17 #define R_SESSION_UTILS_HPP 18 19 #include <string> 20 21 namespace rstudio { 22 namespace core { 23 class Error; 24 class FilePath; 25 } 26 } 27 28 namespace rstudio { 29 namespace r { 30 namespace session { 31 namespace utils { 32 33 // check for R 3.0 34 bool isR3(); 35 36 // check for R 3.3 37 bool isR3_3(); 38 39 bool isPackratModeOn(); 40 41 bool isDevtoolsDevModeOn(); 42 43 bool isDefaultPrompt(const std::string& prompt); 44 45 bool isServerMode(); 46 47 // user home path 48 const core::FilePath& userHomePath(); 49 50 core::FilePath safeCurrentPath(); 51 52 core::FilePath tempFile(const std::string& prefix, 53 const std::string& extension); 54 55 core::FilePath tempDir(); 56 57 core::FilePath logPath(); 58 59 core::FilePath rSourcePath(); 60 61 core::FilePath rHistoryDir(); 62 63 core::FilePath rEnvironmentDir(); 64 65 core::FilePath sessionScratchPath(); 66 67 core::FilePath scopedScratchPath(); 68 69 core::FilePath clientStatePath(); 70 71 core::FilePath projectClientStatePath(); 72 73 core::FilePath startupEnvironmentFilePath(); 74 75 core::FilePath suspendedSessionPath(); 76 77 std::string sessionPort(); 78 79 std::string rCRANUrl(); 80 81 std::string rCRANSecondary(); 82 83 bool restoreWorkspace(); 84 85 bool useInternet2(); 86 87 bool alwaysSaveHistory(); 88 89 bool restoreEnvironmentOnResume(); 90 91 // suppress output in scope 92 class SuppressOutputInScope 93 { 94 public: 95 SuppressOutputInScope(); 96 ~SuppressOutputInScope(); 97 }; 98 99 } // namespace utils 100 } // namespace session 101 } // namespace r 102 } // namespace rstudio 103 104 #endif // R_SESSION_UTILS_HPP 105 106