Skip to content

Commit 89377e6

Browse files
Tal500Tal Hadad
authored andcommitted
fixes
1 parent 903cf7f commit 89377e6

3 files changed

Lines changed: 8 additions & 12 deletions

File tree

.github/workflows/CI-unixish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
5454
- name: integration test
5555
run: |
56-
python3 -m pytest integration_test.py
56+
python3 -m pytest integration_test.py -vv
5757
5858
- name: Run CMake
5959
run: |

.github/workflows/CI-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ jobs:
5757
- name: integration test
5858
run: |
5959
set SIMPLECPP_EXE_PATH=.\${{ matrix.config }}\simplecpp.exe
60-
python -m pytest integration_test.py || exit /b !errorlevel!
60+
python -m pytest integration_test.py -vv || exit /b !errorlevel!
6161

simplecpp.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2725,30 +2725,28 @@ static std::string dirPath(const std::string& path) {
27252725
const std::size_t firstSlash = path.find_last_of("\\/");
27262726
if (firstSlash == std::string::npos) {
27272727
return "";
2728-
} else {
2729-
return path.substr(0, firstSlash + (withTrailingSlash ? 1U : 0U));
27302728
}
2729+
return path.substr(0, firstSlash + (withTrailingSlash ? 1U : 0U));
27312730
}
27322731

27332732
static std::string omitPathTrailingSlash(const std::string& path) {
27342733
if (endsWith(path, "/")) {
27352734
return path.substr(0, path.size() - 1U);
2736-
} else {
2737-
return path;
27382735
}
2736+
return path;
27392737
}
27402738

27412739
static std::string extractRelativePathFromAbsolute(const std::string& absoluteSimplifiedPath, const std::string& prefixSimplifiedAbsoluteDir = currentDirectory()) {
27422740
const std::string normalizedAbsolutePath = omitPathTrailingSlash(absoluteSimplifiedPath);
27432741
std::string currentPrefix = omitPathTrailingSlash(prefixSimplifiedAbsoluteDir);
2744-
std::string leadingParenting = "";
2742+
std::string leadingParenting;
27452743
while (!startsWith_(normalizedAbsolutePath, currentPrefix)) {
27462744
leadingParenting = "../" + leadingParenting;
27472745
currentPrefix = dirPath<false>(currentPrefix);
27482746
}
27492747
const std::size_t size = currentPrefix.size();
27502748
std::string relativeFromMeetingPath = normalizedAbsolutePath.substr(size, normalizedAbsolutePath.size() - size);
2751-
if (startsWith_(relativeFromMeetingPath.c_str(), "/")) {
2749+
if (startsWith_(relativeFromMeetingPath, "/")) {
27522750
// omit the leading slash
27532751
relativeFromMeetingPath = relativeFromMeetingPath.substr(1, relativeFromMeetingPath.size());
27542752
}
@@ -3182,9 +3180,8 @@ static std::string getRelativeFileName(const std::string &baseFile, const std::s
31823180
const std::string absolutePath = expandBaseWithAbsolutePath ? simplifiedPath : toAbsolutePath(simplifiedPath);
31833181
const std::string absoluteBaseFile = expandBaseWithAbsolutePath ? baseFileNormalized : toAbsolutePath(baseFileNormalized);
31843182
return extractRelativePathFromAbsolute(absolutePath, dirPath<true>(absoluteBaseFile));
3185-
} else {
3186-
return simplifiedPath;
31873183
}
3184+
return simplifiedPath;
31883185
}
31893186

31903187
static std::string openHeaderRelative(std::ifstream &f, const std::string &sourcefile, const std::string &header)
@@ -3253,9 +3250,8 @@ static std::string findPathInMapBothRelativeAndAbsolute(const std::map<std::stri
32533250

32543251
if (filedata.find(alternativePath) != filedata.end()) {
32553252
return alternativePath;
3256-
} else {
3257-
return "";
32583253
}
3254+
return "";
32593255
}
32603256

32613257
static std::string getFileIdPath(const std::map<std::string, simplecpp::TokenList *> &filedata, const std::string &sourcefile, const std::string &header, const simplecpp::DUI &dui, bool systemheader)

0 commit comments

Comments
 (0)