FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Unbreak importing files in the same directory as current file. · mdecourse/solvespace@215b8e4 · GitHub

Repository navigation

Commit 215b8e4

Browse files
committed
Unbreak importing files in the same directory as current file.
This commit fixes a bug introduced in commit 0d7aa0a.
1 parent 122920d commit 215b8e4

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

‎src/file.cpp‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -804,17 +804,20 @@ bool SolveSpaceUI::ReloadAllImported(bool canCancel)
804804
g->linkFile = newPath;
805805
}
806806

807-
std::string rel = PathSepUNIXToPlatform(g->linkFileRel);
808-
std::string fromRel = MakePathAbsolute(SS.saveFile, rel);
809-
FILE *test = ssfopen(fromRel, "rb");
810-
if(test) {
811-
fclose(test);
812-
// Okay, exists; update the absolute path.
813-
g->linkFile = fromRel;
814-
} else {
815-
// It doesn't exist. Perhaps the file was moved but the tree wasn't, and we
816-
// can use the absolute filename to get us back. The relative path will be
817-
// updated below.
807+
// In a newly created group we only have an absolute path.
808+
if(!g->linkFileRel.empty()) {
809+
std::string rel = PathSepUNIXToPlatform(g->linkFileRel);
810+
std::string fromRel = MakePathAbsolute(SS.saveFile, rel);
811+
FILE *test = ssfopen(fromRel, "rb");
812+
if(test) {
813+
fclose(test);
814+
// Okay, exists; update the absolute path.
815+
g->linkFile = fromRel;
816+
} else {
817+
// It doesn't exist. Perhaps the file was moved but the tree wasn't, and we
818+
// can use the absolute filename to get us back. The relative path will be
819+
// updated below.
820+
}
818821
}
819822

820823
try_load_file:

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL