aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 88a837f..fc413d4 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -314,7 +314,11 @@ void newProjectCreateConf(const string &projectName, const string &projectType,
string projectConfStr = "[package]\n";
projectConfStr += "name = \"" + projectName + "\"\n";
projectConfStr += "type = \"" + projectType + "\"\n";
- projectConfStr += "version = \"0.1.0\"\n\n";
+ projectConfStr += "version = \"0.1.0\"\n";
+ projectConfStr += "platforms = [\"";
+ projectConfStr += asString(SYSTEM_PLATFORM);
+ projectConfStr += "\"]\n";
+ projectConfStr += "\n";
projectConfStr += "[dependencies]\n";
FileString projectConfPath = projectPath;
@@ -353,6 +357,12 @@ int newProject(int argc, const _tinydir_char_t **argv)
}
string projectName = toUtf8(argv[0]);
+ if(!isProjectNameValid(projectName))
+ {
+ ferr << "Project name can only contain alphanumerical characters, dash (-) or underscore (_)" << endl;
+ exit(20);
+ }
+
FileString projectPath = cwdResult.unwrap();
projectPath += TINYDIR_STRING("/");
projectPath += toFileString(projectName);
@@ -382,7 +392,7 @@ int newProject(int argc, const _tinydir_char_t **argv)
newProjectCreateConf(projectName, projectTypeConf, projectPath);
createProjectSubDir(projectPath + TINYDIR_STRING("/src"));
createProjectSubDir(projectPath + TINYDIR_STRING("/include"));
- createProjectFile(projectPath + TINYDIR_STRING("/src/main.cpp"), "#include <cstdio>\n\nint main()\n{\n return 0;\n}\n");
+ createProjectFile(projectPath + TINYDIR_STRING("/src/main.cpp"), "#include <cstdio>\n\nint main()\n{\n printf(\"hello, world!\\n\");\n return 0;\n}\n");
// We are ignoring git init result on purpose. If it fails, just ignore it; not important
gitInitProject(projectPath);
return 0;