Handling Aliases using POSIX API's

Discussion in 'Mac Programming' started by info1686, Jan 21, 2009.

  1. macrumors newbie

    Joined:
    Jan 21, 2009
    #1
    Hi all,
    I am writing a small backup utility in Mac OS X using C.
    I am stuck up with aliases and trying to find out how they should be backed up.

    I read that the aliases are empty files and they store their content in the resource forks
    I also read that aliases need to be handled using the Alias Manager / Carbon API
    In order to backup aliases, should it suffice if I read the data and resource forks of the alias and backup them up?

    On restoring the alias along with its resource fork, will it again be interpreted as an alias ?

    Also, I will be backing up resource forks of all files hence I need not identify aliases seperately
     
  2. macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #2
    Copying data fork and resource fork is essential; you also need to copy all the finder flags. That should be enough to turn alias files into alias files. It won't handle symbolic links.
     
  3. thread starter macrumors newbie

    Joined:
    Jan 21, 2009
    #3
    Ok, copying of data and resource forks can be done using the standard API's
    But what about the Finder flags?
    How do I get their values?

    Can I use standard API's or only the Carbon API's?

    Why I am asking this is because I feel that use of Carbon API just for aliases is a big overhead

    Thanks in advance
     
  4. thread starter macrumors newbie

    Joined:
    Jan 21, 2009
    #4
    I found HFS+ disk format in the file /usr/include/hfs/hfs_format.h
    It declares a number of structures giving volume info, block info, finder info etc.
    However, it does not declare any API's

    So, how am I supposed to use all those structures?
    Where can I find the necessary API's?
     
  5. macrumors 6502a

    Sayer

    Joined:
    Jan 4, 2002
    Location:
    Austin, TX
    #5
    In the Carbon framework (or maybe CarbonCore specifically). Mac OS X is not just another Unix OS. If you don't back up all files completely you will break something while trying to restore the files, which kinda defeats the purpose of backing them up to begin with.

    I wrote a software installer years ago, it is not just a simple matter of copying files.
     

Share This Page