improved parsing
This commit is contained in:
@@ -114,6 +114,7 @@ string OnlyName(const char *filename)
|
||||
string OnlyExt(const char *filename)
|
||||
{
|
||||
char *extname = new char[1024];
|
||||
extname[0] = '\0';
|
||||
int i;
|
||||
|
||||
int len = (int)strlen(filename);
|
||||
@@ -1385,25 +1386,33 @@ pair<vector<string>, vector<string>> splitCommandLineForParse(char** argv, int a
|
||||
//fdv|f|ftn|for|f90|f95|f03
|
||||
for (int z = 0; z < argc; ++z)
|
||||
{
|
||||
string isFile = argv[z];
|
||||
if (isFile.find(".for") != string::npos ||
|
||||
isFile.find(".f90") != string::npos ||
|
||||
isFile.find(".fdv") != string::npos ||
|
||||
isFile.find(".ftn") != string::npos ||
|
||||
isFile.find(".f95") != string::npos ||
|
||||
isFile.find(".f03") != string::npos ||
|
||||
isFile.find(".f") != string::npos)
|
||||
string arg = argv[z];
|
||||
|
||||
string ext = OnlyExt(arg.c_str());
|
||||
convertToLower(ext);
|
||||
if (ext.find("for") != string::npos ||
|
||||
ext.find("f90") != string::npos ||
|
||||
ext.find("fdv") != string::npos ||
|
||||
ext.find("ftn") != string::npos ||
|
||||
ext.find("f95") != string::npos ||
|
||||
ext.find("f03") != string::npos ||
|
||||
ext.find("f") != string::npos)
|
||||
{
|
||||
if (isFile.find("*") == string::npos)
|
||||
files.insert(isFile);
|
||||
if (arg.find("*") == string::npos)
|
||||
files.insert(arg);
|
||||
else
|
||||
{
|
||||
#if __cplusplus >= 201703L
|
||||
fs::path ext = fs::path(isFile).filename().extension();
|
||||
fs::path ext = fs::path(arg).filename().extension();
|
||||
auto str_ext = ext.string();
|
||||
convertToLower(str_ext);
|
||||
|
||||
for (auto& file : filesInDir)
|
||||
{
|
||||
auto cmp = file.extension().compare(ext);
|
||||
if (cmp == 0)
|
||||
auto cmp_ext = file.extension().string();
|
||||
convertToLower(cmp_ext);
|
||||
|
||||
if (cmp_ext == str_ext)
|
||||
files.insert(file.filename().string());
|
||||
}
|
||||
#endif
|
||||
@@ -1411,10 +1420,10 @@ pair<vector<string>, vector<string>> splitCommandLineForParse(char** argv, int a
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isFile == "-inl")
|
||||
if (arg == "-inl")
|
||||
isInline = true;
|
||||
else
|
||||
options.push_back(isFile);
|
||||
options.push_back(arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_SPF "2257"
|
||||
#define VERSION_SPF "2258"
|
||||
|
||||
Reference in New Issue
Block a user