File system is now read/write on Mac.

This commit is contained in:
rjc%netscape.com 1998-08-06 01:36:42 +00:00
parent 448f0684a7
commit fe4e98d8d3
2 changed files with 89 additions and 9 deletions

View File

@ -8767,13 +8767,21 @@ dropOnSmartURL(HT_Resource dropTarget, char *objURL, PRBool justAction)
HT_DropAction
dropOn (HT_Resource dropTarget, HT_Resource dropObject, PRBool justAction)
{
HT_Resource elders;
#ifdef XP_WIN32
HT_Resource parent;
#endif
HT_Resource elders, parent;
RDF_BT targetType;
RDF_BT objType;
#ifdef XP_MAC
AEEventID actionType;
AEAddressDesc finderAddr = { typeNull, NULL };
AEDescList selection = { typeNull, NULL };
AliasHandle srcAliasH = NULL, destAliasH = NULL;
AppleEvent theEvent = { typeNull, NULL }, theReply = { typeNull, NULL };
FSSpec srcFSS, destFSS;
OSErr err;
ProcessSerialNumber finderPSN = { 0, kNoProcess };
char *errorMsg;
#endif
if (dropTarget == NULL) return(DROP_NOT_ALLOWED);
if (dropObject == NULL) return(DROP_NOT_ALLOWED);
@ -8835,6 +8843,77 @@ dropOn (HT_Resource dropTarget, HT_Resource dropObject, PRBool justAction)
}
else
return DROP_NOT_ALLOWED;
#elif XP_MAC
if (objType == LFS_RT)
{
if (justAction)
{
return COPY_MOVE_CONTENT;
}
else
{
parent = dropObject->parent;
if ((err = nativeMacPathname(resourceID(dropObject->node), &srcFSS)) != noErr) {}
else if ((err = nativeMacPathname(resourceID(dropTarget->node), &destFSS)) != noErr) {}
else if ((err = NewAliasMinimal(&srcFSS, &srcAliasH)) != noErr) {}
else if ((err = NewAliasMinimal(&destFSS, &destAliasH)) != noErr) {}
else
{
if (srcAliasH != NULL) HLock((Handle)srcAliasH);
if (destAliasH != NULL) HLock((Handle)srcAliasH);
actionType = (srcFSS.vRefNum == destFSS.vRefNum) ? kAEMove : kAEDrag;
}
if (err) {}
else if ((err = getPSNbyTypeSig(&finderPSN, 'FNDR', 'MACS')) != noErr) {}
else if ((err = AECreateDesc(typeProcessSerialNumber, &finderPSN,
sizeof(ProcessSerialNumber), &finderAddr)) != noErr) {}
else if ((err = AECreateAppleEvent(kAEFinderEvents /* kAEFinderSuite */,
actionType, &finderAddr, kAutoGenerateReturnID,
kAnyTransactionID, &theEvent)) != noErr) {}
else if ((err = AECreateList (NULL, 0, false, &selection)) != noErr) {}
else if ((err = AEPutPtr (&selection, 0, typeAlias, *srcAliasH, GetHandleSize((Handle)srcAliasH))) != noErr) {}
else if ((err = AEPutParamDesc (&theEvent, keySelection, &selection)) != noErr) {}
else if ((err = AEPutParamPtr (&theEvent, keyDirectObject, typeAlias, *destAliasH, GetHandleSize((Handle)destAliasH))) != noErr) {}
else err = AESend (&theEvent, &theReply,
(kAENoReply | kAEAlwaysInteract | kAECanInteract | kAECanSwitchLayer),
kAENormalPriority, kAEDefaultTimeout, NULL, NULL);
if (err == noErr)
{
/* SetFrontProcess(&finderPSN); */
}
else
{
if ((errorMsg = PR_smprintf("Error %d", (int)err)) != NULL)
{
FE_Alert(NULL, errorMsg);
XP_FREE(errorMsg);
}
}
if (srcAliasH != NULL) DisposeHandle((Handle)srcAliasH);
if (destAliasH != NULL) DisposeHandle((Handle)destAliasH);
if (finderAddr.dataHandle != NULL) AEDisposeDesc(&finderAddr);
if (selection.dataHandle != NULL) AEDisposeDesc (&selection);
if (theEvent.dataHandle != NULL) AEDisposeDesc(&theEvent);
if (theReply.dataHandle != NULL) AEDisposeDesc(&theReply);
/* magic */
destroyViewInt(dropTarget, PR_FALSE);
refreshItemList (dropTarget, HT_EVENT_VIEW_REFRESH);
if (dropTarget->view != parent->view)
{
destroyViewInt(parent, PR_FALSE);
refreshItemList (parent, HT_EVENT_VIEW_REFRESH);
}
return COPY_MOVE_CONTENT;
}
}
else
return DROP_NOT_ALLOWED;
#else
return DROP_NOT_ALLOWED;
#endif

View File

@ -36,6 +36,7 @@
#ifdef XP_MAC
#include "stdlib.h"
#include <Aliases.h>
#endif
#include "rdf.h"