Handling Aliases using POSIX API's

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

  1. info1686 macrumors newbie

    Jan 21, 2009
    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. gnasher729 macrumors P6


    Nov 25, 2005
    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. info1686 thread starter macrumors newbie

    Jan 21, 2009
    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. info1686 thread starter macrumors newbie

    Jan 21, 2009
    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. Sayer macrumors 6502a


    Jan 4, 2002
    Austin, TX
    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