Save aliases for local and remote directories

Previously, the local and remote directories would not get saved with a
project. This makes it so that alias data is populated for the local and
remote directories.
This commit is contained in:
Dietrich Epp 2022-11-16 18:32:52 -05:00
parent 01a3863697
commit 76362fb2c1
1 changed files with 25 additions and 13 deletions

View File

@ -12,6 +12,7 @@
#include "macos/strutil.h" #include "macos/strutil.h"
#include "macos/tempfile.h" #include "macos/tempfile.h"
#include <Aliases.h>
#include <MacMemory.h> #include <MacMemory.h>
#include <MacWindows.h> #include <MacWindows.h>
@ -545,24 +546,35 @@ static void ProjectChooseDir(WindowRef window, ProjectHandle project,
struct Project *projectp; struct Project *projectp;
struct ProjectDir *dirp; struct ProjectDir *dirp;
FSSpec directory; FSSpec directory;
AliasHandle alias;
Handle path; Handle path;
int pathLength; int pathLength;
OSErr err; OSErr err;
if (ChooseDirectory(&directory)) { if (!ChooseDirectory(&directory)) {
err = GetDirPath(&directory, &pathLength, &path); return;
if (err != noErr) {
ExitErrorOS(kErrUnknown, err);
}
projectp = *project;
dirp = &projectp->dirs[whichDir];
if (dirp->path != NULL) {
DisposeHandle(dirp->path);
}
dirp->pathLength = pathLength;
dirp->path = path;
InvalRect(&window->portRect);
} }
err = NewAlias(NULL, &directory, &alias);
if (err != noErr) {
ExitErrorOS(kErrUnknown, err);
}
err = GetDirPath(&directory, &pathLength, &path);
if (err != noErr) {
DisposeHandle((Handle)alias);
ExitErrorOS(kErrUnknown, err);
}
projectp = *project;
dirp = &projectp->dirs[whichDir];
if (dirp->path != NULL) {
DisposeHandle(dirp->path);
}
dirp->pathLength = pathLength;
dirp->path = path;
if (dirp->alias != NULL) {
DisposeHandle((Handle)dirp->alias);
}
dirp->alias = alias;
InvalRect(&window->portRect);
} }
void ProjectMouseDown(WindowRef window, ProjectHandle project, void ProjectMouseDown(WindowRef window, ProjectHandle project,