|
From: John M M. <jo...@us...> - 2003-12-02 05:02:06
|
Update of /cvsroot/squeak/squeak/platforms/Mac OS/vm
In directory sc8-pr-cvs1:/tmp/cvs-serv14578/squeak/platforms/Mac OS/vm
Modified Files:
sqMacUIAppleEvents.c
Log Message:
3.7.0b2 Changes for file name encoding. Ensure we use current encoding when working with file names. Change logic in vmPath, imageName, shortImageName, documentName to support CFString which we convert to desired encoding at read time.
Index: sqMacUIAppleEvents.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/Mac OS/vm/sqMacUIAppleEvents.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** sqMacUIAppleEvents.c 23 Feb 2002 10:47:54 -0000 1.1
--- sqMacUIAppleEvents.c 2 Dec 2003 04:52:56 -0000 1.2
***************
*** 16,26 ****
#include "sqMacUIConstants.h"
#include "sqMacUIEvents.h"
! #include "sqMacImageIO.h"
#include "sqMacFileLogic.h"
#include "DropPlugin.h"
- extern char shortImageName[];
- extern char vmPath[];
-
extern squeakFileOffsetType calculateStartLocationForImage();
--- 16,23 ----
#include "sqMacUIConstants.h"
#include "sqMacUIEvents.h"
! #include "sqMacEncoding.h"
#include "sqMacFileLogic.h"
#include "DropPlugin.h"
extern squeakFileOffsetType calculateStartLocationForImage();
***************
*** 40,44 ****
long result;
- shortImageName[0] = 0;
err = Gestalt(gestaltAppleEventsAttr, &result);
if (err == noErr) {
--- 37,40 ----
***************
*** 51,55 ****
pascal OSErr HandleOpenAppEvent(const AEDescList *aevt, AEDescList *reply, long refCon) {
! /* User double-clicked application; look for "squeak.image" in same directory */
squeakFileOffsetType checkValueForEmbeddedImage;
OSErr err;
--- 47,51 ----
pascal OSErr HandleOpenAppEvent(const AEDescList *aevt, AEDescList *reply, long refCon) {
! /* User double-clicked application; look for "Squeak.image" in same directory */
squeakFileOffsetType checkValueForEmbeddedImage;
OSErr err;
***************
*** 57,73 ****
ProcessInfoRec processInformation;
Str255 name;
FSSpec workingDirectory;
// Get spec to the working directory
err = GetApplicationDirectory(&workingDirectory);
! if (err != noErr) return err;
// Convert that to a full path string.
! PathToDir(vmPath, VMPATH_SIZE,&workingDirectory);
checkValueForEmbeddedImage = calculateStartLocationForImage();
if (checkValueForEmbeddedImage == 0) {
/* use default image name in same directory as the VM */
! strcpy(shortImageName, "squeak.image");
return noErr;
}
--- 53,71 ----
ProcessInfoRec processInformation;
Str255 name;
+ char cname[256];
FSSpec workingDirectory;
// Get spec to the working directory
err = GetApplicationDirectory(&workingDirectory);
! if (err != noErr)
! return err;
// Convert that to a full path string.
! SetVMPath(&workingDirectory);
checkValueForEmbeddedImage = calculateStartLocationForImage();
if (checkValueForEmbeddedImage == 0) {
/* use default image name in same directory as the VM */
! SetShortImageNameViaString("Squeak.image",gCurrentVMEncoding);
return noErr;
}
***************
*** 80,89 ****
if (err != noErr) {
! strcpy(shortImageName, "squeak.image");
! return noErr;
! }
!
! CopyPascalStringToC(name,shortImageName);
! PathToFile(imageName, IMAGE_NAME_SIZE, &workingDirectory);
return noErr;
--- 78,88 ----
if (err != noErr) {
! SetShortImageNameViaString("Squeak.image",gCurrentVMEncoding);
! return noErr;
! }
!
! CopyPascalStringToC(name,cname);
! SetShortImageNameViaString(cname,gCurrentVMEncoding);
! SetImageName( &workingDirectory);
return noErr;
***************
*** 103,106 ****
--- 102,106 ----
WDPBRec pb;
FInfo finderInformation;
+ char shortImageName[256];
reply; refCon; /* reference args to avoid compiler warnings */
***************
*** 108,116 ****
/* record path to VM's home folder */
! if (vmPath[0] == 0) {
err = GetApplicationDirectory(&workingDirectory);
if (err != noErr)
return err;
! PathToDir(vmPath, VMPATH_SIZE, &workingDirectory);
}
--- 108,116 ----
/* record path to VM's home folder */
! if (VMPathIsEmpty()) {
err = GetApplicationDirectory(&workingDirectory);
if (err != noErr)
return err;
! SetVMPath(&workingDirectory);
}
***************
*** 125,129 ****
goto done;
! if (shortImageName[0] != 0) {
/* Do the rest of the documents */
processDocumentsButExcludeOne(&fileList,-1);
--- 125,129 ----
goto done;
! if (!ShortImageNameIsEmpty()) {
/* Do the rest of the documents */
processDocumentsButExcludeOne(&fileList,-1);
***************
*** 135,141 ****
if (imageFileIsNumber == 0) {
// Test is open change set
! strcpy(shortImageName, "squeak.image");
CopyCStringToPascal(shortImageName,workingDirectory.name);
! PathToFile(imageName, IMAGE_NAME_SIZE, &workingDirectory);
fileSpec = workingDirectory;
} else {
--- 135,142 ----
if (imageFileIsNumber == 0) {
// Test is open change set
! strcpy(shortImageName, "Squeak.image");
CopyCStringToPascal(shortImageName,workingDirectory.name);
! SetShortImageNameViaString(shortImageName,gCurrentVMEncoding);
! SetImageName(&workingDirectory);
fileSpec = workingDirectory;
} else {
***************
*** 150,154 ****
CopyPascalStringToC(fileSpec.name,shortImageName);
! PathToFile(imageName, IMAGE_NAME_SIZE,&fileSpec);
}
--- 151,156 ----
CopyPascalStringToC(fileSpec.name,shortImageName);
! SetShortImageNameViaString(shortImageName,gCurrentVMEncoding);
! SetImageName(&fileSpec);
}
***************
*** 255,258 ****
--- 257,261 ----
FSSpec fileSpec;
FInfo finderInformation;
+ char shortImageName[256];
/* count list elements */
***************
*** 271,275 ****
if (err)
goto done;
! CopyPascalStringToC(fileSpec.name,shortImageName);
if (IsImageName(shortImageName) || finderInformation.fdType == 'STim')
--- 274,280 ----
if (err)
goto done;
!
! CopyPascalStringToC(fileSpec.name,shortImageName);
! SetShortImageNameViaString(shortImageName,gCurrentVMEncoding);
if (IsImageName(shortImageName) || finderInformation.fdType == 'STim')
|