Skip to content

Commit

Permalink
Fix invalid parts linkage in assemblies when the folder has only one …
Browse files Browse the repository at this point in the history
…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: solvespace#1347
  • Loading branch information
ruevs authored and phkahler committed Nov 22, 2023
1 parent d5e8a82 commit 6f7e45b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/platform/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
parts.push_back(joined.substr(oldpos));

return parts;
}
Expand Down

0 comments on commit 6f7e45b

Please sign in to comment.