Fix invalid parts linkage in assemblies when the folder has only one char.

Fix a bug in the `Split` function that would drop a single character
directory name at the end of the path.

Because of the above bug when a directory containing an assembly file had
a name with only one character, the assembly file was saved incorrectly and
the path to the linked files was invalid.

For example if `assembly.slvs` was located in a directory called `a` and
links `subpart.slvs` in the same directory this would result in:

Group.impFileRel=a\subpart.slvs

Which resulted in the linked part not being found when opening next time.

Fixes: #1347
This commit is contained in:
ruevs 2023-11-15 23:22:10 +02:00 committed by Paul Kahler
parent d5e8a8267c
commit 6f7e45ba9f

View File

@ -93,9 +93,7 @@ static std::vector<std::string> Split(const std::string &joined, char separator)
pos += 1;
}
if(oldpos != joined.length() - 1) {
parts.push_back(joined.substr(oldpos));
}
return parts;
}