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) {
|
bool SolveSpace::SaveToFile(char *filename) {
|
||||||
// Make sure all the entities are regenerated up to date, since they
|
// 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);
|
SS.GenerateAll(0, INT_MAX);
|
||||||
|
|
||||||
fh = fopen(filename, "wb");
|
fh = fopen(filename, "wb");
|
||||||
|
|
|
@ -319,19 +319,22 @@ void SolveSpace::AddToRecentList(char *file) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SolveSpace::GetFilenameAndSave(bool saveAs) {
|
bool SolveSpace::GetFilenameAndSave(bool saveAs) {
|
||||||
|
char prevSaveFile[MAX_PATH];
|
||||||
|
strcpy(prevSaveFile, saveFile);
|
||||||
|
|
||||||
char newFile[MAX_PATH];
|
if(saveAs || strlen(saveFile)==0) {
|
||||||
strcpy(newFile, saveFile);
|
if(!GetSaveFile(saveFile, SLVS_EXT, SLVS_PATTERN)) return false;
|
||||||
if(saveAs || strlen(newFile)==0) {
|
// need to get new filename directly into saveFile, since that
|
||||||
if(!GetSaveFile(newFile, SLVS_EXT, SLVS_PATTERN)) return false;
|
// determines impFileRel path
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SaveToFile(newFile)) {
|
if(SaveToFile(saveFile)) {
|
||||||
AddToRecentList(newFile);
|
AddToRecentList(saveFile);
|
||||||
strcpy(saveFile, newFile);
|
|
||||||
unsaved = false;
|
unsaved = false;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
// don't store an invalid save filename
|
||||||
|
strcpy(saveFile, prevSaveFile);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,8 @@ void MakePathRelative(const char *basep, char *pathp)
|
||||||
for(i = 0; i < sections; i++) {
|
for(i = 0; i < sections; i++) {
|
||||||
strcat(out, "../");
|
strcat(out, "../");
|
||||||
}
|
}
|
||||||
strcat(out, path+com);
|
// comparison is case-insensitive, but output preserves input case
|
||||||
|
strcat(out, pathp+com);
|
||||||
|
|
||||||
strcpy(pathp, out);
|
strcpy(pathp, out);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user