Skip to content

Commit

Permalink
initial default project file
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Jun 23, 2011
1 parent bedb475 commit 30946d8
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/cpp/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ set (CORE_SOURCE_FILES
http/URL.cpp
http/UriHandler.cpp
http/Util.cpp
r_util/RProjectFile.cpp
system/System.cpp
text/DcfParser.cpp
text/TemplateFilter.cpp
Expand Down
31 changes: 31 additions & 0 deletions src/cpp/core/include/core/r_util/RProjectFile.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* RProjectFile.hpp
*
* Copyright (C) 2009-11 by RStudio, Inc.
*
* This program is licensed to you under the terms of version 3 of the
* GNU Affero General Public License. This program is distributed WITHOUT
* ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
* AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
*
*/

#ifndef CORE_R_UTIL_R_PROJECT_FILE_HPP
#define CORE_R_UTIL_R_PROJECT_FILE_HPP

namespace core {

class Error;
class FilePath;

namespace r_util {

core::Error writeDefaultProjectFile(const FilePath& filePath);

} // namespace r_util
} // namespace core


#endif // CORE_R_UTIL_R_PROJECT_FILE_HPP

47 changes: 47 additions & 0 deletions src/cpp/core/r_util/RProjectFile.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* RProjectFile.cpp
*
* Copyright (C) 2009-11 by RStudio, Inc.
*
* This program is licensed to you under the terms of version 3 of the
* GNU Affero General Public License. This program is distributed WITHOUT
* ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
* AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
*
*/

#include <core/r_util/RProjectFile.hpp>

#include <core/Error.hpp>
#include <core/FilePath.hpp>
#include <core/FileSerializer.hpp>

namespace core {
namespace r_util {

Error writeDefaultProjectFile(const FilePath& filePath)
{
std::string p;
p = "# R project file\n"
"\n"
"# Run .Rprofile file when loading project (Yes/No)\n"
"RunProfile: Yes\n"
"\n"
"# Restore .RData when loading project (Yes/No)\n"
"RestoreWorkspace: Yes\n"
"\n"
"# Save .RData when closing project (Yes/No/Ask)\n"
"SaveWorkspace: Yes\n"
"\n"
"# Save .Rhistory even when not saving .RData (Yes/No)\n"
"AlwaysSaveHistory: Yes\n";

return writeStringToFile(filePath, p);
}

} // namespace r_util
} // namespace core



0 comments on commit 30946d8

Please sign in to comment.