Professional Web Applications Themes

The means to convert path to refId and vrefnum - Mac Programming

What would be the function provided by that platform to convert back and forth a Path to a ParId, vRefnum ? When I tried with those: FSPathMakeRef FSFileMakeFSSpec I usually endup with the parent of the current path I was looking for. Meaning the parent of the parent I am looking for?!?...

  1. #1

    Default The means to convert path to refId and vrefnum

    What would be the function provided by that platform to convert back and
    forth a Path to a ParId, vRefnum ?

    When I tried with those:

    FSPathMakeRef
    FSFileMakeFSSpec


    I usually endup with the parent of the current path I was looking for.
    Meaning the parent of the parent I am looking for?!?




    Denis Guest

  2. #2

    Default Re: The means to convert path to refId and vrefnum

    In article <vif.com>,
    "Denis Work" <net> wrote:
     

    The last component in the path is the leaf. Breaking down any path will
    give you a string identifying the leaf, a directory ID telling what
    directory the file is in, and a volume reference number telling you what
    mounted volume that directory is on (which is not persistent across
    mounts). If you're looking for the directory ID for a given folder, you
    might want to look at PBGetCatInfo.

    --
    Standard output is like your butt. Everyone has one. When using a bathroom,
    they all default to going into a toilet. However, a person can redirect his
    "standard output" to somewhere else, if he so chooses. - Jeremy Nixon
    Gregory Guest

  3. #3

    Default Re: The means to convert path to refId and vrefnum

    I'have just look at "PBGetCatInfo"
    "Calisse" Don't you have something more straightforward to suggest?

    You're right about something thaugh, what we get from Apple comes from their
    standard output...

    Denis Co

    "Gregory Weston" <com> wrote in message
    news:comcast.net... 
    >
    > The last component in the path is the leaf. Breaking down any path will
    > give you a string identifying the leaf, a directory ID telling what
    > directory the file is in, and a volume reference number telling you what
    > mounted volume that directory is on (which is not persistent across
    > mounts). If you're looking for the directory ID for a given folder, you
    > might want to look at PBGetCatInfo.
    >
    > --
    > Standard output is like your butt. Everyone has one. When using a[/ref]
    bathroom, 
    his 


    Denis Guest

  4. #4

    Default Re: The means to convert path to refId and vrefnum

    In article <vif.com>,
    "Denis Work" <net> wrote:
     

    I'm not sure what's problematic about what I suggested. Are you
    suggesting that you don't understand how to use the call, or that you
    understand and consider it too convoluted?

    CInfoPBRec theParam = {};

    Set ioNamePtr, ioVRefNum & ioDirID based on the result from
    FSFileMakeFSSpec.

    Call PBGetCatInfo.

    Read ioDrDirID.

    6 lines of code and 2 declarations counting the call to
    FSFileMakeFSSpec. Not terrible for a task that's discouraged because it
    relies on something fundamentally unreliable. (Path names are not unique
    on the Mac because there's no requirement for mounted volume names to
    be.)

     

    Actually, Apple's is some of the best first-party reference
    doentation I've seen. Stress the word reference, though. I'm not sure
    what the current state of their tutorial content is; when I started with
    the Mac, the state was "absent."

    --
    Standard output is like your butt. Everyone has one. When using a bathroom,
    they all default to going into a toilet. However, a person can redirect his
    "standard output" to somewhere else, if he so chooses. - Jeremy Nixon
    Gregory Guest

  5. #5

    Default Re: The means to convert path to refId and vrefnum

    In article <vif.com>,
    "Denis Work" <net> wrote:
     

    FSSpecs contain the vRefNum and parID. par ID means "ID of the parent
    folder". The "name" field in an FSSpec contains the name of the actual
    file. So, I'm not surprised at all. This is what you're supposed to get.

    Some APIs contain FSSpecs to folders as just the parID and the vRefNum,
    with an empty name. Apple's MoreFiles (MoreFilesX?) sample code contains
    functions for converting between those, I think. However, since only
    folders have directory IDs, you can't use a parID and vRefNum without a
    name to refer to a file, which is why the canonical form of an FSSpec is
    more common.

    I guess you just misread the API docs.

    Cheers,
    -- Uli
    http://www.zathras.de
    Uli Guest

  6. #6

    Default Re: The means to convert path to refId and vrefnum

    Hi,

    Yes I did seen those and read the man.

    Here is a better explanation of my trouble:

    It works only on a file that already exist, not on a new
    uncreated file.

    Here how it goes on one end of the driver I create the name and path of the
    file to be. Converted that to a path.
    ....
    Several functions and classes later...
    ....
    Convert that path to a Par ID, and vRefNum.

    <problem: when the file does not exist> it gives me the ParID and the
    vRefNum of the path (parent).
    When I create the file it ends up one path above the path I was targeting.


    Thanks,
    Denis


    "Uli Kusterer" <de> wrote in message
    news:t-online.com... 
    >
    > FSSpecs contain the vRefNum and parID. par ID means "ID of the parent
    > folder". The "name" field in an FSSpec contains the name of the actual
    > file. So, I'm not surprised at all. This is what you're supposed to get.
    >
    > Some APIs contain FSSpecs to folders as just the parID and the vRefNum,
    > with an empty name. Apple's MoreFiles (MoreFilesX?) sample code contains
    > functions for converting between those, I think. However, since only
    > folders have directory IDs, you can't use a parID and vRefNum without a
    > name to refer to a file, which is why the canonical form of an FSSpec is
    > more common.
    >
    > I guess you just misread the API docs.
    >
    > Cheers,
    > -- Uli
    > http://www.zathras.de[/ref]


    Denis Guest

  7. #7

    Default Re: The means to convert path to refId and vrefnum

    In article <vif.com>,
    "Denis Work" <net> wrote:
     

    That is how FSRefs are doented to behave. They only work for
    existing files. If you want to refer to a non-existent file, use an
    FSRef to the containing folder and keep around the name (as an
    HFSUniStr255 or a CFString).
     

    A parID and vRefNum *always* points to a folder. It *can't* point to a
    file, period. Files don't have directory IDs, only directories (=
    folders) do. If you want to refer to a file, you need the dirID and
    vRefNum of the parent folder plus the name of a file contained in it.
    That is what an FSSpec is, for example.

    If you only keep around the dirID and the vRefNum of a file's parent
    folder, you will only get a parent folder, because you just discarded
    the information on the file.

    Hope that clears things up. Or maybe I'm completely misunderstanding
    your problem? A code sample may help. But you may want to re-read the
    docs. One of the things most often stated in the docs is that FSRefs can
    only point to existing files, and Navigation Services consequently
    returns an FSRef to the folder and the name of the file that should be
    created. This shouldn't be a surprise to you if you have understood the
    docs.

    Note that I'm not trying to insinuate that this is any fault on your
    part. Technical docs aren't always easy to understand, especially in a
    foreign language like English. But from this, it looks like you will
    want to go back and read it a second time, to make sure you get the
    stuff that wasn't clear until now.

    Hope that helps,
    -- Uli Kusterer
    http://www.zathras.de
    Uli Guest

  8. #8

    Default Re: The means to convert path to refId and vrefnum

    Thanks anyway,

    BTW: I did read the docs, I come here only as a last resort.
    I don't think the problem is of language per say.

    Here is what I was looking for:

    ////////////////////////////////////////////////////////////////////////////
    ///////////////////////
    void CFilePath::GetCurrentDocDesc ()
    {
    #ifdef _MAC_
    FSRef ThisRef;
    FSCatalogInfo ThisInfo;
    OSStatus RetStatus;

    RetStatus = FSFindFolder(kUserDomain, kDoentsFolderType,
    kCreateFolder, &ThisRef);
    if(RetStatus == NO_ERROR){

    RetStatus = FSGetCatalogInfo(&ThisRef, kFSCatInfoVolume |
    kFSCatInfoNodeID, &ThisInfo, NULL, NULL, NULL);

    if(RetStatus != NO_ERROR){
    goto FailSpec;
    }
    m_VRefNum = ThisInfo.volume;
    m_parID = ThisInfo.nodeID;
    m_FileCreator = kNavGenericSignature;
    m_FileType = 0;
    } else {
    FailSpec:
    m_VRefNum = 0; // I WISH THERE WAS A PROVIDED DEFAULT HERE!
    m_parID = 0;
    m_FileCreator = kNavGenericSignature;
    m_FileType = 0;
    }
    #else
    m_VRefNum = 0; // ON WINDOWS...
    m_parID = 0;
    m_FileCreator = 0;
    m_FileType = 0;
    #endif
    }
    ////////////////////////////////////////////////////////////////////////////
    ///////////////////////
    For ease of reading paste this in a fixed font editor.

    The actual function that process path and files is too complexe to put here.
    But that illustrate the principle.
    As you can see, you were misslead, a "FSRefs" can indeed POINT to a path.

    Regards,
    Denis



    "Uli Kusterer" <de> wrote in message
    news:t-online.com... 
    >
    > That is how FSRefs are doented to behave. They only work for
    > existing files. If you want to refer to a non-existent file, use an
    > FSRef to the containing folder and keep around the name (as an
    > HFSUniStr255 or a CFString).
    > [/ref]
    targeting. 


    Denis Guest

  9. #9

    Default Re: The means to convert path to refId and vrefnum

    In article <vif.com>,
    "Denis Work" <net> wrote:
     

    Apparently at least part of the problem is of language, because Uli
    never said it couldn't. Uli said (correctly) that a FSRef must point to
    a file which exists. Since directories _are_ files, your sample above
    does not contradict this.

    One quick note:
     [/ref]

    Best, for most purposes, is an Alias record.

    G

    --
    Standard output is like your butt. Everyone has one. When using a bathroom,
    they all default to going into a toilet. However, a person can redirect his
    "standard output" to somewhere else, if he so chooses. - Jeremy Nixon
    Gregory Guest

  10. #10

    Default Re: The means to convert path to refId and vrefnum

    You must be right, I really don't understand what your saying.

    He said:
     

    "that FSRefs can only point to existing files" That's not true.

    In any case this is not very clear. And really not helping me in anyway.
    If I recall my original question I needed the means to convert a "PATH"
    back and forth to parId, and vRefNum.

    The way you (both) reply anyway is condescendant, who needs that?

    Anyway, I solved my problem.

    Regards,
    Denis


    "Gregory Weston" <com> wrote in message
    news:comcast.net... [/ref]
    //////////////////////////////////////////////////////////////////////////// [/ref]
    //////////////////////////////////////////////////////////////////////////// [/ref]
    here. [/ref]
    path. [/ref]
    >
    > Best, for most purposes, is an Alias record.
    >
    > G
    >
    > --
    > Standard output is like your butt. Everyone has one. When using a[/ref]
    bathroom, 
    his 


    Denis Guest

  11. #11

    Default Re: The means to convert path to refId and vrefnum

    In article <vif.com>, "Denis Work" <net>
    wrote:
     

    It is 100% true. You are confused.

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Guest

  12. #12

    Default Re: The means to convert path to refId and vrefnum

    hein! What so confusing a file is a file, a path is a path.


    "Miro Jurisic" <org> wrote in message
    news:mit.edu... 
    <net> 
    >
    > It is 100% true. You are confused.
    >
    > meeroh
    >
    > --
    > If this message helped you, consider buying an item
    > from my wish list: <http://web.meeroh.org/wishlist>
    >[/ref]


    Denis Guest

  13. #13

    Default Re: The means to convert path to refId and vrefnum

    In article <vif.com>,
    "Denis Work" <net> wrote:
     
    > <net> 
    > >
    > > It is 100% true. You are confused.
    > >
    > > meeroh
    > >[/ref]
    >
    > hein! What so confusing a file is a file, a path is a path.[/ref]

    A file is an object within the file system.
    A path is a string describing the location of a file.

    If you're using any significantly different definition of either of
    those terms, you're not speaking the same language as we are. I would go
    so far as to suggest you're not speaking the same language as the vast
    majority of programmers.
     [/ref]

    --
    Standard output is like your butt. Everyone has one. When using a bathroom,
    they all default to going into a toilet. However, a person can redirect his
    "standard output" to somewhere else, if he so chooses. - Jeremy Nixon
    Gregory Guest

  14. #14

    Default Re: The means to convert path to refId and vrefnum

    In article <vif.com>,
    "Denis Work" <net> wrote:
     
    >
    > "that FSRefs can only point to existing files" That's not true.[/ref]

    Yes, it is. If you try to create an FSRef point to a non-existent file,
    you will get an error and the FSRef will not be valid.

     

    Apparently you, given that you're not understanding what's been clearly
    stated.

    Take a step back and look at what you've been told. You were given
    honest answers in good faith to the questions as you presented them.
    There's nothing condescending about that. You on the other hand have
    been borderline rude and are giving every appearance of being resistant
    to legitimate attempts to help you.

    G

    --
    Standard output is like your butt. Everyone has one. When using a bathroom,
    they all default to going into a toilet. However, a person can redirect his
    "standard output" to somewhere else, if he so chooses. - Jeremy Nixon
    Gregory Guest

  15. #15

    Default Re: The means to convert path to refId and vrefnum

     

    That is exactly my point!

    Per ogy:
    A word can be many thing but cannot be a sentence.
    It can be a verb, a subject...

    So a path is not a file and I wanted the ID and the vRefnum on it (the Path
    itself).
    Which I could obtain once I learned about:
     [/ref]
    Right after I got the FSref from;
    RetStatus = FSPathMakeRef((const UInt8 *)PathName, &FileRef,
    OutIsDirectory);

    Regards,
    Denis

    N.B. Who do you think I am?


    "Gregory Weston" <com> wrote in message
    news:comcast.net... 
    > > <net> 
    > >
    > > hein! What so confusing a file is a file, a path is a path.[/ref]
    >
    > A file is an object within the file system.
    > A path is a string describing the location of a file.
    >
    > If you're using any significantly different definition of either of
    > those terms, you're not speaking the same language as we are. I would go
    > so far as to suggest you're not speaking the same language as the vast
    > majority of programmers.
    > [/ref]
    >
    > --
    > Standard output is like your butt. Everyone has one. When using a[/ref]
    bathroom, 
    his 


    Denis Guest

  16. #16

    Default Re: The means to convert path to refId and vrefnum

    In article <vif.com>,
    "Denis Work" <net> wrote:
     
    >
    > That is exactly my point![/ref]

    But it's contradictory to what you seem to have been saying.

     

    I don't understand that ogy at all.

     

    You're still missing it. A path is a string. A name. Nothing more. It
    does not have an ID and a vRefNum. I'm getting the impression that
    you're using the word "path" to mean "directory." That's not the common
    usage. A directory is a file. It's a special kind of file, but a file
    nevertheless.

    At the root of my hard drive is a directory named Applications. The path
    is "/Applications". (Abusing punctuation rules for clarity.) Inside this
    folder is a directory named Droplets which contains a file named
    StorePurge. The path of this file is
    "/Applications/Droplets/StorePurge". I'm believing that as you're using
    the term, you would say the path is not the fully specified name, but
    the directory referenced by "/Applications/Droplets".

    Does that sound like a fair assessment of the way you've been using the
    words?

    G

    --
    Standard output is like your butt. Everyone has one. When using a bathroom,
    they all default to going into a toilet. However, a person can redirect his
    "standard output" to somewhere else, if he so chooses. - Jeremy Nixon
    Gregory Guest

  17. #17

    Default Re: The means to convert path to refId and vrefnum

     
     
    nevertheless. 

    No, it is not!

    A "path" is an abstract concept like love, karma...
    A "Directory' is also an abstract concept. I can guaranty you 100% that
    there nothing physical about a directory beside it's own notion. It is not a
    like zip file. which is a physical vector on your Hard disk, even a
    scattered one (fragmented).
    A bundle on the other hand, shares two abstract, one as a unit, and the
    other one as a group, what you call fork. it becomes obvious when you move
    those units to another system that does not share the concept.

    In reality and physically, it is a directory (path, trail, conduit,
    corridor...) and files, make no misstake.

    Again, when I ask for the mean to convert a path to it's refID, and vRefnum,
    lecturing me about reading the doc does not help, but aggravates me. In
    other words, I would be better off answerless.

    hth
    Denis



    "Gregory Weston" <com> wrote in message
    news:comcast.net... 
    > >
    > > That is exactly my point![/ref]
    >
    > But it's contradictory to what you seem to have been saying.
    >

    >
    > I don't understand that ogy at all.
    >
    > [/ref]
    Path 
    >
    > You're still missing it. A path is a string. A name. Nothing more. It
    > does not have an ID and a vRefNum. I'm getting the impression that
    > you're using the word "path" to mean "directory." That's not the common
    > usage. A directory is a file. It's a special kind of file, but a file
    > nevertheless.
    >
    > At the root of my hard drive is a directory named Applications. The path
    > is "/Applications". (Abusing punctuation rules for clarity.) Inside this
    > folder is a directory named Droplets which contains a file named
    > StorePurge. The path of this file is
    > "/Applications/Droplets/StorePurge". I'm believing that as you're using
    > the term, you would say the path is not the fully specified name, but
    > the directory referenced by "/Applications/Droplets".
    >
    > Does that sound like a fair assessment of the way you've been using the
    > words?
    >
    > G
    >
    > --
    > Standard output is like your butt. Everyone has one. When using a[/ref]
    bathroom, 
    his 


    Denis Guest

  18. #18

    Default Re: The means to convert path to refId and vrefnum

    On Thu, 15 Jul 2004, Denis Work wrote:
     

    > nevertheless. 
    >
    > No, it is not!
    >
    > A "path" is an abstract concept like love, karma...
    > A "Directory' is also an abstract concept. I can guaranty you 100% that
    > there nothing physical about a directory beside it's own notion. It is not a
    > like zip file. which is a physical vector on your Hard disk, even a
    > scattered one (fragmented).
    > A bundle on the other hand, shares two abstract, one as a unit, and the
    > other one as a group, what you call fork. it becomes obvious when you move
    > those units to another system that does not share the concept.
    >
    > In reality and physically, it is a directory (path, trail, conduit,
    > corridor...) and files, make no misstake.
    >
    > Again, when I ask for the mean to convert a path to it's refID, and vRefnum,
    > lecturing me about reading the doc does not help, but aggravates me. In
    > other words, I would be better off answerless.[/ref]

    Yes, of course. You know everything, and we are clueless. That is why we
    are asking lots of basic questions, and you are the one giving complete,
    working code. Wait, wait, no, that's backwards. Now I'm all confused.
    Michael Guest

  19. #19

    Default Re: The means to convert path to refId and vrefnum

    Look again my friend.



    "Michael Ash" <com> wrote in message
    news:twistedsys.net... 
    > > 
    > > nevertheless. 
    > >
    > > No, it is not!
    > >
    > > A "path" is an abstract concept like love, karma...
    > > A "Directory' is also an abstract concept. I can guaranty you 100% that
    > > there nothing physical about a directory beside it's own notion. It is[/ref][/ref]
    not a [/ref]
    move [/ref]
    vRefnum, 
    >
    > Yes, of course. You know everything, and we are clueless. That is why we
    > are asking lots of basic questions, and you are the one giving complete,
    > working code. Wait, wait, no, that's backwards. Now I'm all confused.[/ref]


    Denis Guest

  20. #20

    Default Re: The means to convert path to refId and vrefnum

    Sorry, I was heating my lunch over the keyboard.

    Please ignore the previous message, you did get that right, I am the one
    providing the complete working code. I would not have it, nor make it, any
    other way...

    But, I do not know everything, never implied it, and I was looking for
    answer.
    But then I got struggle in a fight and lecture about that I do not
    understand, did not read right, and so on.
    Where just a answer telling me or showing me how to do it in the first place
    would have just do right.

    Regards,
    Denis



    "Michael Ash" <com> wrote in message
    news:twistedsys.net... 
    > > 
    > > nevertheless. 
    > >
    > > No, it is not!
    > >
    > > A "path" is an abstract concept like love, karma...
    > > A "Directory' is also an abstract concept. I can guaranty you 100% that
    > > there nothing physical about a directory beside it's own notion. It is[/ref][/ref]
    not a [/ref]
    move [/ref]
    vRefnum, 
    >
    > Yes, of course. You know everything, and we are clueless. That is why we
    > are asking lots of basic questions, and you are the one giving complete,
    > working code. Wait, wait, no, that's backwards. Now I'm all confused.[/ref]


    Denis Guest

Page 1 of 2 12 LastLast

Similar Threads

  1. Convert text path back to regular path
    By greg_humphrey@adobeforums.com in forum Adobe Illustrator Macintosh
    Replies: 2
    Last Post: August 9th, 12:07 PM
  2. convert text to path
    By nicola_daly@adobeforums.com in forum Adobe Illustrator Windows
    Replies: 3
    Last Post: September 2nd, 02:56 PM
  3. Convert to Path error
    By laihuattan in forum Macromedia Freehand
    Replies: 0
    Last Post: July 31st, 04:25 PM
  4. Convert Path to Shape
    By agreen in forum Adobe Photoshop 7, CS, CS2 & CS3
    Replies: 6
    Last Post: September 9th, 06:42 PM
  5. Convert Physical path to Virtual path?
    By Scott Tilton in forum ASP
    Replies: 2
    Last Post: July 11th, 03:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139