|
From: <cre...@us...> - 2006-10-19 18:33:23
|
Revision: 1572
http://svn.sourceforge.net/frontierkernel/?rev=1572&view=rev
Author: creecode
Date: 2006-10-19 11:26:30 -0700 (Thu, 19 Oct 2006)
Log Message:
-----------
fix a problem with crashing when trying to open files when the default root wasn't present
Modified Paths:
--------------
Frontier/branches/FSRef_Migration/Common/source/filepath.c
Frontier/branches/FSRef_Migration/Common/source/shellfile.c
Modified: Frontier/branches/FSRef_Migration/Common/source/filepath.c
===================================================================
--- Frontier/branches/FSRef_Migration/Common/source/filepath.c 2006-10-18 08:10:51 UTC (rev 1571)
+++ Frontier/branches/FSRef_Migration/Common/source/filepath.c 2006-10-19 18:26:30 UTC (rev 1572)
@@ -549,7 +549,7 @@
boolean setfsfile ( ptrfilespec fs, bigstring bsfile ) {
//
- // 2006-08-29 creedon: for Mac, FSRef-ized
+ // 2006-10-18 creedon: for Mac, FSRef-ized
//
// 2004-10-26 aradke: Since the getmacfileinfo/foldertest gymnastics do not seem to fit any particular purpose and since
// none of our callers seem to rely it since they usually pass in a file rather than a directory, I
@@ -562,19 +562,11 @@
#ifdef MACVERSION
- if ( FSRefValid ( &( *fs ).fsref ) && ( *fs ).path == NULL ) {
+ if ( ( *fs ).path != NULL )
+ CFRelease ( ( *fs ).path );
- HFSUniStr255 name;
- OSErr err = FSGetCatalogInfo ( &( *fs ).fsref, kFSCatInfoNone, NULL, NULL, NULL, &( *fs ).fsref );
-
- bigstringToHFSUniStr255 ( bsfile, &name );
-
- err = FSMakeFSRefUnicode ( &( *fs ).fsref, name.length, name.unicode, kTextEncodingUnknown, &( *fs ).fsref );
-
- }
- else
- ( *fs ).path = CFStringCreateWithPascalString ( kCFAllocatorDefault, bsfile, kCFStringEncodingMacRoman );
-
+ ( *fs ).path = CFStringCreateWithPascalString ( kCFAllocatorDefault, bsfile, kCFStringEncodingMacRoman );
+
return ( true );
#endif
Modified: Frontier/branches/FSRef_Migration/Common/source/shellfile.c
===================================================================
--- Frontier/branches/FSRef_Migration/Common/source/shellfile.c 2006-10-18 08:10:51 UTC (rev 1571)
+++ Frontier/branches/FSRef_Migration/Common/source/shellfile.c 2006-10-19 18:26:30 UTC (rev 1572)
@@ -300,12 +300,14 @@
boolean shellopen (void) {
- /*
- 2.1b4 dmb: option-open to show all types
+ //
+ // 2006-10-18 creedon: for Mac, FSRef-ized
+ //
+ // 5.0d3 dmb: look in clickers table for types we can actually open
+ //
+ // 2.1b4 dmb: option-open to show all types
+ //
- 5.0d3 dmb: look in clickers table for types we can actually open
- */
-
tyconfigrecord lconfig;
tyfilespec fspec;
tysftypelist filetypes;
@@ -315,7 +317,7 @@
boolean fl;
hdlwindowinfo hdummy;
- if (!keyboardstatus.floptionkey) { /*2.1b4*/
+ if (!keyboardstatus.floptionkey) { // 2.1b4
shellgetconfig (iddefaultconfig, &lconfig);
@@ -323,7 +325,7 @@
filetypes.types [0] = lconfig.filetype;
- // filetypes.types [1] = '2CLK'; // application glue files
+ // filetypes.types [1] = '2CLK'; // application glue files
ptypes = &filetypes;
}
@@ -341,17 +343,21 @@
clearbytes (&fspec, sizeof (fspec));
- //RAB: 1/27/98 - make this look better when opening a file after the root is open
+ // RAB: 1/27/98 - make this look better when opening a file after the root is open
+
if (ccfindrootwindow (&hdummy) == false)
getstringlist (defaultlistnumber, startupfileprompt, bs);
else
getstringlist (defaultlistnumber, nonstartupfileprompt, bs);
- if (!sfdialog (sfgetfileverb, bs, ptypes, &fspec, 'LAND')) /* 2005-10-06 creedon - added 'LAND' */
+ if (!sfdialog (sfgetfileverb, bs, ptypes, &fspec, 'LAND')) // 2005-10-06 creedon - added 'LAND'
return (false);
- return (shellopenfile (&fspec, false, nil));
- } /*shellopen*/
+ ( void ) extendfilespec ( &fspec, &fspec );
+
+ return ( shellopenfile ( &fspec, false, nil ) );
+
+ } // shellopen
static void prepuserforwait (WindowPtr w) {
@@ -1382,7 +1388,7 @@
// no files were selected to be open from the finder. we either open a new file, or we try to open the default startup file --
// similar to autoexec.bat from MS-DOS and System.Startup from UCSD Pascal.
//
- // 2006-06-18 creedon: for Mac, FSRef-ized
+ // 2006-10-18 creedon: for Mac, FSRef-ized
//
// 7.30.97 dmb: use defaultpath instead of application filespec, and use new setfsfile to plug in default file name
//
@@ -1394,10 +1400,9 @@
// 5/20/91 dmb: if the option key is down, just do a normal open file
//
+ bigstring bsdefault;
+ boolean fl = false, flfolder;
tyfilespec fs;
- boolean fl = false;
- boolean flfolder;
- bigstring bsdefault;
if (optionkeydown ())
return (shellopen ());
@@ -1407,22 +1412,27 @@
if (config.flnewonlaunch)
fl = shellnew ();
else {
+
getapplicationfilespec (nil, &fs); // get our own app filespec
-
- ( void ) extendfilespec ( &fs, &fs );
-
+
if (getstringlist (defaultlistnumber, startupfilename, bsdefault)) {
setfsfile (&fs, bsdefault);
-
+
+ ( void ) extendfilespec ( &fs, &fs );
+
if (fileexists (&fs, &flfolder))
fl = shellopenfile (&fs, false, nil);
else {
filegetdefaultpath (&fs);
- setfsfile (&fs, bsdefault);
+ ( void ) extendfilespec ( &fs, &fs );
+ setfsfile ( &fs, bsdefault );
+
+ ( void ) extendfilespec ( &fs, &fs );
+
if (fileexists (&fs, &flfolder))
fl = shellopenfile (&fs, false, nil);
else
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|