Improve relative paths for file import.
Don't break on case-sensitive filesystems, and don't require an explicit regen after initial save of the assembly.
This commit is contained in:
parent
044a4ea8fc
commit
403d3c04d2
|
@ -255,7 +255,10 @@ void SolveSpace::SaveUsingTable(int type) {
|
|||
|
||||
bool SolveSpace::SaveToFile(char *filename) {
|
||||
// Make sure all the entities are regenerated up to date, since they
|
||||
// will be exported.
|
||||
// will be exported. We reload the imported files because that rewrites
|
||||
// the impFileRel for our possibly-new filename.
|
||||
SS.later.showTW = true;
|
||||
SS.ReloadAllImported();
|
||||
SS.GenerateAll(0, INT_MAX);
|
||||
|
||||
fh = fopen(filename, "wb");
|
||||
|
|
|
@ -319,19 +319,22 @@ void SolveSpace::AddToRecentList(char *file) {
|
|||
}
|
||||
|
||||
bool SolveSpace::GetFilenameAndSave(bool saveAs) {
|
||||
char prevSaveFile[MAX_PATH];
|
||||
strcpy(prevSaveFile, saveFile);
|
||||
|
||||
char newFile[MAX_PATH];
|
||||
strcpy(newFile, saveFile);
|
||||
if(saveAs || strlen(newFile)==0) {
|
||||
if(!GetSaveFile(newFile, SLVS_EXT, SLVS_PATTERN)) return false;
|
||||
if(saveAs || strlen(saveFile)==0) {
|
||||
if(!GetSaveFile(saveFile, SLVS_EXT, SLVS_PATTERN)) return false;
|
||||
// need to get new filename directly into saveFile, since that
|
||||
// determines impFileRel path
|
||||
}
|
||||
|
||||
if(SaveToFile(newFile)) {
|
||||
AddToRecentList(newFile);
|
||||
strcpy(saveFile, newFile);
|
||||
if(SaveToFile(saveFile)) {
|
||||
AddToRecentList(saveFile);
|
||||
unsaved = false;
|
||||
return true;
|
||||
} else {
|
||||
// don't store an invalid save filename
|
||||
strcpy(saveFile, prevSaveFile);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,8 @@ void MakePathRelative(const char *basep, char *pathp)
|
|||
for(i = 0; i < sections; i++) {
|
||||
strcat(out, "../");
|
||||
}
|
||||
strcat(out, path+com);
|
||||
// comparison is case-insensitive, but output preserves input case
|
||||
strcat(out, pathp+com);
|
||||
|
||||
strcpy(pathp, out);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user