Some minor fixes related to newlines and formatting

toml-checker
Duncan Ogilvie 3 years ago
parent 09c9c28934
commit 77f4bf7da0

@ -35,7 +35,7 @@ link-libraries = [
"ghc_filesystem", "ghc_filesystem",
"mpark_variant", "mpark_variant",
"ordered_map", "ordered_map",
"nlohmann_json" "nlohmann_json",
] ]
cmake-after = """ cmake-after = """
generate_resources(${CMKR_TARGET}) generate_resources(${CMKR_TARGET})

@ -119,7 +119,7 @@ int generate_project(const char *str) {
const auto tomlbuf = format(cmake_toml, dir_name.c_str(), dir_name.c_str(), str, installed.c_str(), target.c_str(), dest.c_str()); const auto tomlbuf = format(cmake_toml, dir_name.c_str(), dir_name.c_str(), str, installed.c_str(), target.c_str(), dest.c_str());
if (strcmp(str, "interface")) { if (strcmp(str, "interface")) {
std::ofstream ofs("src/main.cpp"); std::ofstream ofs("src/main.cpp", std::ios::binary);
if (ofs.is_open()) { if (ofs.is_open()) {
ofs << mainbuf; ofs << mainbuf;
} }
@ -127,7 +127,7 @@ int generate_project(const char *str) {
ofs.close(); ofs.close();
} }
std::ofstream ofs2("cmake.toml"); std::ofstream ofs2("cmake.toml", std::ios::binary);
if (ofs2.is_open()) { if (ofs2.is_open()) {
ofs2 << tomlbuf; ofs2 << tomlbuf;
} }
@ -607,7 +607,7 @@ int generate_cmake(const char *path, const parser::Project *parent_project) {
j["description"] = project.project_description; j["description"] = project.project_description;
} }
std::ofstream ofs("vcpkg.json"); std::ofstream ofs("vcpkg.json", std::ios::binary);
if (!ofs) { if (!ofs) {
throw std::runtime_error("Failed to create a vcpkg.json manifest file!"); throw std::runtime_error("Failed to create a vcpkg.json manifest file!");
} }
@ -900,7 +900,7 @@ int generate_cmake(const char *path, const parser::Project *parent_project) {
if (!fs::exists(list_path)) if (!fs::exists(list_path))
return true; return true;
std::ifstream ifs(list_path, std::ios_base::binary); std::ifstream ifs(list_path, std::ios::binary);
if (!ifs.is_open()) { if (!ifs.is_open()) {
throw std::runtime_error("Failed to read " + list_path.string()); throw std::runtime_error("Failed to read " + list_path.string());
} }
@ -910,7 +910,7 @@ int generate_cmake(const char *path, const parser::Project *parent_project) {
}(); }();
if (should_regenerate) { if (should_regenerate) {
std::ofstream ofs(list_path, std::ios_base::binary); std::ofstream ofs(list_path, std::ios::binary);
if (ofs.is_open()) { if (ofs.is_open()) {
ofs << ss.str(); ofs << ss.str();
} else { } else {

Loading…
Cancel
Save