aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-02-16 00:18:50 +0100
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:39:58 +0200
commit04f7cf535992f05ea56c701f25a6adad564796ae (patch)
tree239630bb7b416f6478d21e3e72b4680016b6349e /src
parentc0bc9fc3a99b2e5710e92597a723d3db1b9e638c (diff)
Allow dot in project name
Diffstat (limited to 'src')
-rw-r--r--src/Conf.cpp2
-rw-r--r--src/main.cpp21
2 files changed, 12 insertions, 11 deletions
diff --git a/src/Conf.cpp b/src/Conf.cpp
index e3c894a..eb66b6d 100644
--- a/src/Conf.cpp
+++ b/src/Conf.cpp
@@ -637,7 +637,7 @@ namespace sibs
for(int i = 0; i < projectName.size(); ++i)
{
char c = projectName[i];
- if(!isalpha(c) && !isdigit(c) && c != '-' && c != '_')
+ if(!isalpha(c) && !isdigit(c) && c != '-' && c != '_' && c != '.')
return false;
}
diff --git a/src/main.cpp b/src/main.cpp
index 5efafe6..af43892 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -793,6 +793,15 @@ static void gitIgnoreAppendSibs(const FileString &gitIgnoreFilePath)
ferr << "Failed to add sibs to .gitignore, reason: " << toFileString(result.getErrMsg()) << endl;
}
+static void validateProjectName(const std::string &projectName)
+{
+ if(!isProjectNameValid(projectName))
+ {
+ ferr << "Project name can only contain alphanumerical characters, dash (-), underscore (_), dot (.) and has to be at least 1 character long" << endl;
+ exit(20);
+ }
+}
+
static int initProject(int argc, const _tinydir_char_t **argv)
{
FileString projectPath;
@@ -939,11 +948,7 @@ static int initProject(int argc, const _tinydir_char_t **argv)
else
projectName = toUtf8(projectPath);
- if(!isProjectNameValid(projectName))
- {
- ferr << "Project name can only contain alphanumerical characters, dash (-) or underscore (_) and has to be longer than 0 characters" << endl;
- exit(20);
- }
+ validateProjectName(projectName);
auto createProjectConfResult = newProjectCreateConf(projectName, projectTypeConf, projectPath);
if(!createProjectConfResult)
@@ -1320,11 +1325,7 @@ static int newProject(int argc, const _tinydir_char_t **argv)
exit(20);
}
- if(!isProjectNameValid(projectName))
- {
- ferr << "Project name can only contain alphanumerical characters, dash (-) or underscore (_)" << endl;
- exit(20);
- }
+ validateProjectName(projectName);
FileString projectPath = cwdResult.unwrap();
projectPath += TINYDIR_STRING("/");