Xojo Conferences
XDCMay2019MiamiUSA

New FolderItem("ddd") or REALFSRefFromFolderItem return bogus in OSX (Real Studio Plugins Mailinglist archive)

Back to the thread list
Previous thread: OSX vs carbon/classic
Next thread: Using Jaguar calls


Re: Using Jaguar calls   -   Christian Schmitz
  New FolderItem("ddd") or REALFSRefFromFolderItem return bogus in OSX   -   Alfred Van Hoek
   Re: New FolderItem("ddd") or REALFSRefFromFolderItem return bogus in OSX   -   Joseph J. Strout
    Re: New FolderItem("ddd") or REALFSRefFromFolderItem return bogus in OSX   -   Alfred Van Hoek
     Re: New FolderItem("ddd") or REALFSRefFromFolderItem return bogus in OSX   -   Joseph J. Strout

New FolderItem("ddd") or REALFSRefFromFolderItem return bogus in OSX
Date: 09.09.02 05:30 (Mon, 09 Sep 2002 00:30:43 -0400)
From: Alfred Van Hoek

"GetFolderitem" or "new Folderitem" appear not to work in OSX, contrary to
running in Carbon or Classic 9. This is observed following a call to res f.CreateResourceFork.

Similarly "REALFSRefFromFolderItem" does not give the parentFSRef (OSX)
under these circumstances; When GetFolderitem, or new Folderitem is used,
to obtain a folderitem, REALFSRefFromFolderItem, however, will give the
parent FSRef in Carbon 9. ( but not OSX ).

I find this pretty serious...

Alfred

---
A searchable archive of this list is available at:
<http://dbserver.realsoftware.com/KBDB/search.php>

Unsubscribe:
<mailto:<email address removed>>

Subscribe to the digest:
<mailto:<email address removed>>

Re: New FolderItem("ddd") or REALFSRefFromFolderItem return bogus in OSX
Date: 09.09.02 05:38 (Sun, 8 Sep 2002 21:38:55 -0700)
From: Joseph J. Strout
At 12:30 AM -0400 9/09/02, Alfred Van Hoek wrote:

>"GetFolderitem" or "new Folderitem" appear not to work in OSX, contrary to
>running in Carbon or Classic 9. This is observed following a call to res >f.CreateResourceFork.

They do work, in general; I've been living in OS X for a couple of
months now and none of my projects would work if I couldn't make a
folder item. So, (1) what makes you say they don't work, and (2) why
are you reporting this on the plugins list?

>Similarly "REALFSRefFromFolderItem" does not give the parentFSRef (OSX)
>under these circumstances; When GetFolderitem, or new Folderitem is used,
>to obtain a folderitem, REALFSRefFromFolderItem, however, will give the
>parent FSRef in Carbon 9. ( but not OSX ).

Hmm, I'm not quite following you. What REALFSRefFromFolderItem
should do is give you the FSRef of the file itself (not the parent).
If that file doesn't exist, then of course that's impossible, since
FSRefs (unlike FSSpecs) only represent files that exist.

Best,
- Joe

Re: New FolderItem("ddd") or REALFSRefFromFolderItem return bogus in OSX
Date: 09.09.02 10:18 (Mon, 09 Sep 2002 05:18:46 -0400)
From: Alfred Van Hoek
on 9/9/02 12:38 AM, Joseph J. Strout at <email address removed> wrote:

>> "GetFolderitem" or "new Folderitem" appear not to work in OSX, contrary to
>> running in Carbon or Classic 9. This is observed following a call to res >> f.CreateResourceFork.
>
> They do work, in general; I've been living in OS X for a couple of
> months now and none of my projects would work if I couldn't make a
> folder item. So, (1) what makes you say they don't work, and (2) why
> are you reporting this on the plugins list?

For a couple of reasons it is reported here and not elsewhere; "new
folderItem" is used to get a new folderItem, which then is to be used in a
plugin. The plugin requires the creation of a resource file next to the
project file. In stead off trying to implement this with toolbox-calls
only, REALbasic API is used to get to the location. Thus, use new
folderItem to get to the location, and then use "FSCreateResFile" (carbon)
or "FSpCreateResFile" (classic) to create. "FSCreateResFile" yields nothing
in OSX, and to test whether or not REALbasic is able to create it, it
appears that "res = f.createResourceFork" fails too. This suggests that
something more general (creation of a resourcefile) is wrong. I know that
in some other cases new folderItem works in OSX, but it looks like not here,
and yes an error -43 is generated (OSX).

"REALFSRefFromFolderItem" is used to get a FSRef, see below:
>
>> Similarly "REALFSRefFromFolderItem" does not give the parentFSRef (OSX)
>> under these circumstances; When GetFolderitem, or new Folderitem is used,
>> to obtain a folderitem, REALFSRefFromFolderItem, however, will give the
>> parent FSRef in Carbon 9. ( but not OSX ).
>
> Hmm, I'm not quite following you. What REALFSRefFromFolderItem
> should do is give you the FSRef of the file itself (not the parent).
> If that file doesn't exist, then of course that's impossible, since
> FSRefs (unlike FSSpecs) only represent files that exist.

I quote:

REALFSRefFromFolderItem PPC OSX
RB 4.5b1

This function attempts to obtain an FSRef from a REALfolderItem. If the file
exists, its FSRef is returned in the outRef parameter; if it doesn't exist,
the parent FSRef is returned there instead. The outName parameter receives
the name of the file in either case. Either outRef or outName may be nil if
you're not interested in one or the other. If outName is nil and the file
doesn't exist, then outRef is not changed and this function returns false.
That will also happen if you're running on a system that does not support
FSRefs.
Parameters:
f REALfolderItem folderItem of interest
outRef FSRef* receives the FSRef of this item, or its parent (may be
nil)
outName HFSUniStr255* receives the full name of this item (may be nil)
Returns: Boolean true if successful, false if failed

We know that a file is not associated with new folderItem. In classic a
FSSpec can be obtained to write data into for the creation of a file. In
carbon a nil FSRef is obtained, so you should work with the parent and use
the trivial

FSCreateResFile(&mFSRef,
name.length,
name.unicode,
kFSCatInfoNone,
NULL,
NULL, // FSRef* can be NULL
&newFile); // FSSpec* can be NULL

An FSSpec is used to be able to set the creator and type (valid for OSX
too). As I said in carbon 9 the above works, but not in OSX.

Yes, also tested with newFSref in stead of newFile...

"REALFSRefFromFolderItem" is meant to obtain the FSRef or the parent FSRef
according to your documentation, and a parent is obtained as far as I can
judge when running in carbon 9.

Please advice on how to workaround this or indicate possible mistakes...

Alfred

---
A searchable archive of this list is available at:
<http://dbserver.realsoftware.com/KBDB/search.php>

Unsubscribe:
<mailto:<email address removed>>

Subscribe to the digest:
<mailto:<email address removed>>

Re: New FolderItem("ddd") or REALFSRefFromFolderItem return bogus in OSX
Date: 09.09.02 15:20 (Mon, 9 Sep 2002 07:20:35 -0700)
From: Joseph J. Strout
At 5:18 AM -0400 9/09/02, Alfred Van Hoek wrote:

> > Hmm, I'm not quite following you. What REALFSRefFromFolderItem
>> should do is give you the FSRef of the file itself (not the parent).
>> If that file doesn't exist, then of course that's impossible, since
>> FSRefs (unlike FSSpecs) only represent files that exist.
>
>I quote:
>
>This function attempts to obtain an FSRef from a REALfolderItem. If the file
>exists, its FSRef is returned in the outRef parameter; if it doesn't exist,
>the parent FSRef is returned there instead.

Oh yes, sorry, I'd forgotten about that last night.

>"REALFSRefFromFolderItem" is meant to obtain the FSRef or the parent FSRef
>according to your documentation, and a parent is obtained as far as I can
>judge when running in carbon 9.
>
>Please advice on how to workaround this or indicate possible mistakes...

Please demonstrate what the problem is.

Thanks,
- Joe