|
From: <cre...@us...> - 2006-11-05 00:39:16
|
Revision: 1589
http://svn.sourceforge.net/frontierkernel/?rev=1589&view=rev
Author: creecode
Date: 2006-11-04 16:39:13 -0800 (Sat, 04 Nov 2006)
Log Message:
-----------
for Mac, in sfdialog function, fix a problem with returning gibberish if fs was pointing to a volume
Modified Paths:
--------------
Frontier/trunk/Common/source/filedialog.c
Modified: Frontier/trunk/Common/source/filedialog.c
===================================================================
--- Frontier/trunk/Common/source/filedialog.c 2006-11-03 22:26:25 UTC (rev 1588)
+++ Frontier/trunk/Common/source/filedialog.c 2006-11-05 00:39:13 UTC (rev 1589)
@@ -485,16 +485,16 @@
boolean sfdialog ( tysfverb sfverb, bigstring bsprompt, ptrsftypelist filetypes, ptrfilespec fspec, OSType filecreator ) {
//
- // return true if the user selected a file with one of the SF routines,
- // return false otherwise.
+ // return true if the user selected a file with one of the SF routines, return false otherwise.
//
- // as a bonus, we return the full path for the selected file in the path
- // string.
+ // as a bonus, we return the full path for the selected file in the path string.
//
#ifdef MACVERSION
//
+ // 2006-11-04 creedon: fix a problem with returning gibberish if fs was pointing to a volume
+ //
// 2006-09-15 creedon: minimally FSRef-ized
//
// 2005-10-06 creedon: added filecreator parameter, used for get file dialog
@@ -620,9 +620,9 @@
break;
}
- //if the user canceled return false
- //I know that oserror can handle this, but lets make it
- //obvious that we are checking.
+ // if the user canceled return false, I know that oserror can handle this, but lets make it obvious that we are
+ // checking.
+
if (userCanceledErr == err)
return false;
@@ -631,15 +631,27 @@
if ( sfdata.sfreply.sfGood ) { // canonize
+ bigstring bs;
+ boolean fl = ( *fs ).parID == fsRtParID;
HFSUniStr255 name;
- FSMakeFSRef ( ( *fs ).vRefNum, ( *fs ).parID, NULL, &( *fspec ).fsref );
+ setemptystring ( bs );
+
+ if ( fl )
+ copystring ( ( *fs ).name, bs );
+
+ err = FSMakeFSRef ( ( *fs ).vRefNum, ( *fs ).parID, bs, &( *fspec ).fsref );
- err = HFSNameGetUnicodeName ( ( *fs ).name, kTextEncodingUnknown, &name );
-
- ( *fspec ).path = CFStringCreateWithCharacters ( kCFAllocatorDefault, name.unicode, name.length );
+ if ( ! fl ) {
+ err = HFSNameGetUnicodeName ( ( *fs ).name, kTextEncodingUnknown, &name );
+
+ ( *fspec ).path = CFStringCreateWithCharacters ( kCFAllocatorDefault, name.unicode, name.length );
+
+ }
+
return ( true );
+
}
return (false);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|